Unhandled exceptions cause ASP.NET-based applications to unexpectedly quit in the .NET Framework 2.0
2006-04-01 23:52
1071 查看
SYMPTOMS
When an unhandled exception is thrown in a Microsoft ASP.NET-based application that is built on the Microsoft .NET Framework 2.0, the application unexpectedly quits. When this problem occurs, no exception information that you must have to understanding the issue is logged in the Application log.However, an event message that is similar to the following may be logged in the System log:
Event Type: Warning
Event Source: W3SVC
Event Category: None
Event ID: 1009
Date: 9/28/2005
Time: 3:18:11
PM User: N/A
Computer: IIS-SERVER
Description:
A process serving application pool ‘DefaultAppPool’ terminated unexpectedly. The process id was ‘2548’. The process exit code was ‘0xe0434f4d’.
Additionally, an event message that is similar to the following may be logged in the Application log:
Event Type: Error
Event Source: .NET Runtime 2.0 Error Reporting
Event Category: None
Event ID: 5000
Date: 9/28/2005
Time: 3:18:02 PM
User: N/A
Computer: IIS-SERVER
Description:
EventType clr20r3, P1 w3wp.exe, P2 6.0.3790.1830, P3 42435be1, P4 app_web_7437ep-9, P5 0.0.0.0, P6 433b1670, P7 9, P8 a, P9 system.exception, P10 NIL.
CAUSE
This problem occurs because the default policy for unhandled exceptions has changed in the .NET Framework 2.0. By default, the policy for unhandled exceptions is to end the worker process.In the Microsoft .NET Framework 1.1 and in the Microsoft .NET Framework 1.0, unhandled exceptions on managed threads were ignored. Unless you attached a debugger to catch the exception, you would not realize that anything was wrong.
ASP.NET uses the default policy for unhandled exceptions in the .NET Framework 2.0. When an unhandled exception is thrown, the ASP.NET-based application unexpectedly quits.
This behavior does not apply to exceptions that occur in the context of a request. These kinds of exceptions are still handled and wrapped by an HttpException object. Exceptions that occur in the context of a request do not cause the worker process to end. However, unhandled exceptions outside the context of a request, such as exceptions on a timer thread or in a callback function, cause the worker process to end.
RESOLUTION
Change the unhandled exception policy back to the default behavior that occurs in the .NET Framework 1.1 and in the .NET Framework 1.0.Note We do not recommend that you change the default behavior. If you ignore exceptions, the application may leak resources and abandon locks.
To enable this default behavior, add the following code to the Aspnet.config file that is located in the following folder:
%WINDIR%/Microsoft.NET/Framework/v2.0.50727
[code]<configuration> <runtime> <legacyUnhandledExceptionPolicy enabled="true" /> </runtime> </configuration>
当然还有种方法,复杂多,不推荐,也就不贴出来了
[/code]
相关文章推荐
- 4 ways to send a PDF file to the IE Client in ASP.NET 2.0
- Configuring Autofac to work with the ASP.NET Identity Framework in MVC 5
- 4 ways to send a PDF file to the IE Client in ASP.NET 2.0
- How to Pop Open an image window that resizes to fit the image in ASP.net 1.x and 2.0 Beta 1
- 设置页面的默认焦点控件和默认接受事件控件How Do I Set the DefaultFocus or DefaultButton in a Page Based on a Master Page in ASP.NET 2.0
- How to set the DefaultButton in a Page Based on ASP.NET Master Page
- Breaking Changes for ASP.NET 2.0 applications running in Integrated mode on IIS 7.0
- How to Choose the Best Way to Pass Multiple Models in ASP.NET MVC
- Beginning ASP .NET 2.0 E-Commerce in C# 2005: From Novice to Professional
- Using the ASP.NET 2.0 ReportViewer in Local Mode
- What's New in the .NET Framework 2.0 Beta
- [转载]How to hide the OK button in the dialog in .Net Compact Framework application?
- How to achive the CRUD in ASP.NET MVC(VS2010)
- How To Implement Forms-Based Authentication in Your ASP.NET Application by Using C# .NET
- Rewrite the master page form action attribute in asp.net 2.0
- .NET错误The 'targetFramework' attribute in the <compilation> element of the Web.config file is used only to target version 4.0 and later of the .NET Framework
- How to get the Current Controller Name, Action, or ID in ASP.NET MVC
- Use the MachineKey API to protect values in ASP.NET
- [转]An introduction to OAuth 2.0 using Facebook in ASP.NET Core
- What's New in the .NET Framework 2.0 Beta