HttpRequest.TimedOutToken 属性


获取请求超时时去除的 CancellationToken 对象。Gets a CancellationToken object that is tripped when a request times out.

 property System::Threading::CancellationToken TimedOutToken { System::Threading::CancellationToken get(); };
public System.Threading.CancellationToken TimedOutToken { get; }
member this.TimedOutToken : System.Threading.CancellationToken
Public ReadOnly Property TimedOutToken As CancellationToken


取消标记。The cancellation token.


可以在 web.config 文件(请参阅HttpRuntimeSection.ExecutionTimeout)或以编程方式指定超时期限(请参见HttpServerUtility.ScriptTimeout)。The timeout period can be specified in the Web.config file (see HttpRuntimeSection.ExecutionTimeout) or programmatically (see HttpServerUtility.ScriptTimeout). 超时期限从请求传入的时间开始算起。The timeout period is measured from the time the request comes in. 如果默认的超时值为110秒,则在请求处理开始后,取消标记将不早于110秒。If the default timeout of 110 seconds is in effect, the cancellation token will be tripped no earlier than 110 seconds after request processing begins. 您可以更改HttpServerUtility.ScriptTimeout属性值,并且只要此标记尚未转到,就会考虑新的超时值。You can change the HttpServerUtility.ScriptTimeout property value, and as long this token hasn't tripped yet, the new timeout value will be respected.

目前,令牌仅提供15秒的粒度,这意味着,如果超时值为110秒,则在请求处理开始后,令牌将在110到125秒之间触发。Currently the token only provides 15 second granularity, which means that if the timeout value is 110 seconds, the token will be tripped sometime between 110 and 125 seconds after request processing begins. 粒度可能会在将来发生变化。The granularity may change in the future.

即使此属性是线程安全的,但使用时也存在限制。Even though this property is thread-safe, there are restrictions on its use. 有关详细信息,请参阅 HttpResponse.ClientDisconnectedTokenFor more information, see HttpResponse.ClientDisconnectedToken.

如果 Websocket 请求处理已开始,则此属性无意义。This property is meaningless if WebSockets request processing has started.