HttpContext.ThreadAbortOnTimeout 属性

定义

获取或设置一个值,此值指示 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.

public:
 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

属性值

true 如果 Abort() 将调用,当线程时间;否则, falsetrue if Abort() will be called when the thread times out; otherwise, false. 默认值为 trueThe default is true.

注解

在使用 HttpRequest.TimedOutToken 属性实现协作取消的处理程序和模块中,你可能希望禁用 ASP.NET 在请求超时时默认执行的 Thread.Abort 行为。将此属性设置为 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.

适用于