HttpWorkerRequest.SendCalculatedContentLength 方法

定义

Content-LengthHTTP 标头添加到响应。Adds a Content-Length HTTP header to the response.

重载

SendCalculatedContentLength(Int32)

Content-Length HTTP 标头添加到小于或等于 2 GB 的消息正文的响应。Adds a Content-Length HTTP header to the response for message bodies that are less than or equal to 2 GB.

SendCalculatedContentLength(Int64)

Content-Length HTTP 标头添加到大于 2 GB 的消息正文的响应。Adds a Content-Length HTTP header to the response for message bodies that are greater than 2 GB.

SendCalculatedContentLength(Int32)

Content-Length HTTP 标头添加到小于或等于 2 GB 的消息正文的响应。Adds a Content-Length HTTP header to the response for message bodies that are less than or equal to 2 GB.

public:
 virtual void SendCalculatedContentLength(int contentLength);
public virtual void SendCalculatedContentLength (int contentLength);
abstract member SendCalculatedContentLength : int -> unit
override this.SendCalculatedContentLength : int -> unit
Public Overridable Sub SendCalculatedContentLength (contentLength As Integer)

参数

contentLength
Int32

响应的长度(按字节计)。The length of the response, in bytes.

注解

如果未显式设置内容长度,则此方法会使 HttpWorkerRequest 实例将 Content-Length HTTP 标头添加到响应。When the content length is not explicitly set, this method enables the HttpWorkerRequest instance to add a Content-Length HTTP header to the response.

当响应消息正文的长度小于或等于 2 GB 时,使用此重载设置 Content-Length 标头。Use this overload to set the Content-Length header when the length of the response message body is less than or equal to 2 GB.

另请参阅

SendCalculatedContentLength(Int64)

Content-Length HTTP 标头添加到大于 2 GB 的消息正文的响应。Adds a Content-Length HTTP header to the response for message bodies that are greater than 2 GB.

public:
 virtual void SendCalculatedContentLength(long contentLength);
public virtual void SendCalculatedContentLength (long contentLength);
abstract member SendCalculatedContentLength : int64 -> unit
override this.SendCalculatedContentLength : int64 -> unit
Public Overridable Sub SendCalculatedContentLength (contentLength As Long)

参数

contentLength
Int64

响应的长度(按字节计)。The length of the response, in bytes.

注解

如果未显式设置内容长度,则此方法会使 HttpWorkerRequest 实例将 Content-Length HTTP 标头添加到响应。When the content length is not explicitly set, this method enables the HttpWorkerRequest instance to add a Content-Length HTTP header to the response. 默认实现将调用采用类型 Int32contentLength 参数的重载。The default implementation calls the overload that takes a contentLength parameter of type Int32.

此重载用于指定大于 2 GB 的消息正文的响应。Use this overload to specify the response for message bodies greater than 2 GB.

另请参阅

适用于