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.