无法为路由不同于 xyz 的 asp.net 通用 Webhook 设置 URI。com/api/webhooks/incoming/*
Cannot set a URI for asp.net generic webhooks with a route different than xyz.com/api/webhooks/incoming/*
我似乎无法找到一种方法来为通用 asp.net webhook 设置这样的 URI,其路由以 /portalapi/v1/* 开头。例如。像这样:
config.Routes.MapHttpRoute(
name: "PortalApi",
routeTemplate: "portalapi/v1/{controller}/{id}",
defaults: new { id = RouteParameter.Optional }
);
webhook 接收器似乎只响应 api/*:
形式的 URI 的帖子
config.Routes.MapHttpRoute(
name: "DefaultApi",
routeTemplate: "api/{controller}/{id}",
defaults: new { id = RouteParameter.Optional }
);
我错过了什么吗?或者这是一个错误?有没有人能够更改路线的开头并让 webhook 调用接受它?
我通读了这个微软文档,但没有找到任何答案:
https://docs.microsoft.com/en-us/aspnet/webhooks/receiving/receivers
我在 github 上与 AspNetWebHooks 团队有公开的票证。
https://github.com/aspnet/AspNetWebHooks/issues/62
你不能,因为它不受支持,而且该项目处于维护模式,因此永远不会得到支持。
// Use a constant template since all WebHook constraints use the resulting route values and we have no
// requirements for user-specified route templates.
private static string ChooseTemplate()
{
var template = "/api/webhooks/incoming/"
+ $"{{{WebHookConstants.ReceiverKeyName}}}/"
+ $"{{{WebHookConstants.IdKeyName}?}}";
return template;
}
我似乎无法找到一种方法来为通用 asp.net webhook 设置这样的 URI,其路由以 /portalapi/v1/* 开头。例如。像这样:
config.Routes.MapHttpRoute(
name: "PortalApi",
routeTemplate: "portalapi/v1/{controller}/{id}",
defaults: new { id = RouteParameter.Optional }
);
webhook 接收器似乎只响应 api/*:
形式的 URI 的帖子 config.Routes.MapHttpRoute(
name: "DefaultApi",
routeTemplate: "api/{controller}/{id}",
defaults: new { id = RouteParameter.Optional }
);
我错过了什么吗?或者这是一个错误?有没有人能够更改路线的开头并让 webhook 调用接受它?
我通读了这个微软文档,但没有找到任何答案: https://docs.microsoft.com/en-us/aspnet/webhooks/receiving/receivers
我在 github 上与 AspNetWebHooks 团队有公开的票证。 https://github.com/aspnet/AspNetWebHooks/issues/62
你不能,因为它不受支持,而且该项目处于维护模式,因此永远不会得到支持。
// Use a constant template since all WebHook constraints use the resulting route values and we have no
// requirements for user-specified route templates.
private static string ChooseTemplate()
{
var template = "/api/webhooks/incoming/"
+ $"{{{WebHookConstants.ReceiverKeyName}}}/"
+ $"{{{WebHookConstants.IdKeyName}?}}";
return template;
}