DelegatingHandler 类

定义

将 HTTP 响应消息的处理委托给另一处理程序(称为“内部处理程序”)的 HTTP 处理程序的类型。A type for HTTP handlers that delegate the processing of HTTP response messages to another handler, called the inner handler.

public ref class DelegatingHandler abstract : System::Net::Http::HttpMessageHandler
public abstract class DelegatingHandler : System.Net.Http.HttpMessageHandler
type DelegatingHandler = class
    inherit HttpMessageHandler
Public MustInherit Class DelegatingHandler
Inherits HttpMessageHandler
继承
DelegatingHandler
派生

注解

在调用 SendAsync之前,应用程序应在构造函数中或通过 InnerHandler 属性提供内部处理程序;否则,将引发 InvalidOperationExceptionAn application should provide an inner handler either in the constructor or through the InnerHandler property before calling SendAsync; otherwise, an InvalidOperationException will be thrown.

请注意,InnerHandler 属性也可能是委托处理程序。Note that InnerHandler property may be a delegating handler as well. 此方法允许创建处理程序堆栈来处理 HTTP 响应消息。This approach allows the creation of handler stacks to process the HTTP response messages.

构造函数

DelegatingHandler()

创建 DelegatingHandler 类的新实例。Creates a new instance of the DelegatingHandler class.

DelegatingHandler(HttpMessageHandler)

创建特定内部处理程序的 DelegatingHandler 类的新实例。Creates a new instance of the DelegatingHandler class with a specific inner handler.

属性

InnerHandler

获取或设置处理 HTTP 响应消息的内部处理程序。Gets or sets the inner handler which processes the HTTP response messages.

方法

Dispose()

释放由 HttpMessageHandler 使用的非托管资源和托管资源。Releases the unmanaged resources and disposes of the managed resources used by the HttpMessageHandler.

(继承自 HttpMessageHandler)
Dispose(Boolean)

释放由 DelegatingHandler 使用的非托管资源,并可根据需要释放托管资源。Releases the unmanaged resources used by the DelegatingHandler, and optionally disposes of the managed resources.

Equals(Object)

确定指定对象是否等于当前对象。Determines whether the specified object is equal to the current object.

(继承自 Object)
GetHashCode()

用作默认哈希函数。Serves as the default hash function.

(继承自 Object)
GetType()

获取当前实例的 TypeGets the Type of the current instance.

(继承自 Object)
MemberwiseClone()

创建当前 Object 的浅表副本。Creates a shallow copy of the current Object.

(继承自 Object)
SendAsync(HttpRequestMessage, CancellationToken)

以异步操作的形式将 HTTP 请求发送到内部处理程序,然后再发送到服务器。Sends an HTTP request to the inner handler to send to the server as an asynchronous operation.

ToString()

返回表示当前对象的字符串。Returns a string that represents the current object.

(继承自 Object)

适用于