HttpRequest.TimedOutToken HttpRequest.TimedOutToken HttpRequest.TimedOutToken HttpRequest.TimedOutToken Property


取得要求逾時已過時觸動的 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.

Token 目前只提供15秒的資料細微性,這表示如果 timeout 值是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.