如何从MessageHandler检索ActionDescriptor?
我可以使用以下代码在SendAsync方法中获取ContractDescriptor:
var config = request.GetConfiguration();
_controllerSelector = config.Services.GetService(typeof(IHttpControllerSelector)) as IHttpControllerSelector;
HttpControllerDescriptor descriptor = _controllerSelector.SelectController(request);
但是我不知道如何获取ActionDescriptor。
谢谢!
答案 0 :(得分:1)
您可以使用System.Net.Http.HttpRequestMessageExtensions中的扩展名:
//using System.Net.Http;
var actionDescriptor = request.GetActionDescriptor();