HttpContext.ThreadAbortOnTimeout HttpContext.ThreadAbortOnTimeout HttpContext.ThreadAbortOnTimeout HttpContext.ThreadAbortOnTimeout Property


取得或設定值,這個值指定 ASP.NET 執行階段是否應該在要求逾時已過時正在處理這個要求的執行緒上呼叫 Abort()Gets or sets a value that specifies whether the ASP.NET runtime should call Abort() on the thread that is servicing this request when the request times out.

 property bool ThreadAbortOnTimeout { bool get(); void set(bool value); };
public bool ThreadAbortOnTimeout { get; set; }
member this.ThreadAbortOnTimeout : bool with get, set
Public Property ThreadAbortOnTimeout As Boolean


如果會在執行緒逾時呼叫 Abort() 則為 true,否則為 falsetrue if Abort() will be called when the thread times out; otherwise, false. 預設為 trueThe default is true.


在使用HttpRequest.TimedOutToken屬性來執行合作式取消的處理常式和模組中, 您可能會想要Thread.Abort停用在要求超時時, ASP.NET 預設執行的行為。將此屬性設定false為可協助您確保取消和清除常式會執行, 而不會因為 ASP.NET 而中斷。In handlers and modules that are using the HttpRequest.TimedOutToken property to implement cooperative cancellation, you might wish to disable the Thread.Abort behavior that ASP.NET performs by default when a request times out. Setting this property to false can help you make sure that cancellation and cleanup routines will run without being interrupted by ASP.NET.

如果您將此屬性設定false為, 則當發生超時時, ASP.NET 不會自動顯示「要求超時」錯誤頁面。If you set this property to false, ASP.NET will not automatically display a "Request timed out" error page when a timeout occurs. 應用程式會負責適當地設定回應內容。The application is responsible for setting the response content appropriately.