【发布时间】:2020-01-25 21:23:09
【问题描述】:
我正在使用端点路由,我想为给定的 url 和可能的请求方法找到正确的端点对象。如果我至少可以根据 url 找到 Endpoint,那会很有帮助。本质上,我希望实现以下方法。
public Endpoint GetEndpoint(HttpContext httpContext, string url, string requestMethod)
{
// I can get all of the endpoints
var endpointDataSource = httpContext.RequestServices.GetService<EndpointDataSource>();
var endpoints = endpointDataSource.Endpoints;
// But I'm not sure what to do here
}
我想也许我可以使用DefaultLinkParser.cs,但到目前为止我还没有想通。
【问题讨论】:
标签: asp.net-core-3.1