IHttpMessageHandlerFactory.CreateHandler(String) 方法
定义
使用与 name 指定的逻辑名称相对应的配置来创建和配置 HttpMessageHandler 实例。Creates and configures an HttpMessageHandler instance using the configuration that corresponds to the logical name specified by name.
public:
System::Net::Http::HttpMessageHandler ^ CreateHandler(System::String ^ name);
public System.Net.Http.HttpMessageHandler CreateHandler (string name);
abstract member CreateHandler : string -> System.Net.Http.HttpMessageHandler
Public Function CreateHandler (name As String) As HttpMessageHandler
参数
- name
- String
要创建的消息处理程序的逻辑名称。The logical name of the message handler to create.
返回
新 HttpMessageHandler 实例。A new HttpMessageHandler instance.
注解
默认 IHttpMessageHandlerFactory 实现可能会缓存基础 HttpMessageHandler 实例以提高性能。The default IHttpMessageHandlerFactory implementation may cache the underlying HttpMessageHandler instances to improve performance.
默认 IHttpMessageHandlerFactory 实现还管理所创建的处理程序的生存期,因此释放 HttpMessageHandler 此方法返回的可能不起作用。The default IHttpMessageHandlerFactory implementation also manages the lifetime of the handler created, so disposing of the HttpMessageHandler returned by this method may have no effect.