HttpApplication.Error HttpApplication.Error HttpApplication.Error HttpApplication.Error Event

定义

当引发未经处理的异常时发生。Occurs when an unhandled exception is thrown.

public:
 event EventHandler ^ Error;
public event EventHandler Error;
member this.Error : EventHandler 
Public Custom Event Error As EventHandler 

注解

引发Error事件的异常可以通过调用GetLastError方法来访问。The exception that raises the Error event can be accessed by a call to the GetLastError method. 如果应用程序生成自定义错误输出, 请通过调用ClearError方法来取消 ASP.NET 生成的默认错误消息。If your application generates custom error output, suppress the default error message that is generated by ASP.NET by a call to the ClearError method.

备注

如果你的 web 应用程序包含 XML web services, 则不Error能将事件用于这些服务的全局异常处理。If your Web application contains XML Web services, you cannot use the Error event for global exception handling of those services. XML Web services 的 HTTP 处理程序使用在 XML Web service 中发生的任何异常, 并在调用前Error将其转换为 SOAP 错误。The HTTP handler for XML Web services consumes any exception that occurs in an XML Web service and converts it to a SOAP fault before the Error being called. 若要处理 XML Web service 异常, 请生成一个 SOAP 扩展, 以在自定义全局异常处理程序中处理 Web 服务异常。To handle XML Web service exceptions, build a SOAP extension to process Web service exceptions in a custom global exception handler.

有关如何处理事件的详细信息, 请参阅处理和引发事件For more information about how to handle events, see Handling and Raising Events.

适用于

另请参阅