C# 如何在ASP.NET核心中实现IHttpRequestFeature

C# 如何在ASP.NET核心中实现IHttpRequestFeature,c#,.net,C#,.net,我用红隼 您有实现的具体示例吗?我使用它来查找ASP.NET核心API控制器的请求路径: var httpFeatures = HttpContext.Features.Get<IHttpRequestFeature>(); if (httpFeatures == null) { string path = httpFeatures.Path; } var-httpFeatures=HttpContext.Features.Get(); if(httpFeatu

我用红隼


您有实现的具体示例吗?

我使用它来查找ASP.NET核心API控制器的请求路径:

var httpFeatures = HttpContext.Features.Get<IHttpRequestFeature>();

 if (httpFeatures == null)
 {
    string path = httpFeatures.Path;
  }
var-httpFeatures=HttpContext.Features.Get();
if(httpFeatures==null)
{
字符串路径=httpFeatures.path;
}
返回路径“/api/client/ipaddress/islocal”


参考资料:

您是指httpFeatures!=无效的