Case Study: “HTTP Error 500.0 - Internal Server Error” from AspNetInitClrHostFailureModule
Symptom
The user receives the following “HTTP Error 500.0 – Internal Server Error” message when he accesses the ASP.NET application running on Windows Server 2008 R2 computer.
HTTP Error 500.0 - Internal Server Error An error message detailing the cause of this specific request failure can be found in the application event log of the web server. Please review this log entry to discover what caused this error to occur. |
Detailed error information are:
Module AspNetInitClrHostFailureModule |
Requested URL https://localhost:80/default.aspx |
Notification BeginRequest |
Physical Path C:\inetpub\wwwroot\default.aspx |
Handler PageHandlerFactory-Integrated-4.0 |
Logon Method Not yet determined |
Error Code 0x80070002 |
Logon User Not yet determined |
You may notice that a rare module AspNetInitClrHostFailureModule appears and the error code is 0x80070002 which means “The system cannot find the file specified”.
In the application event log the corresponded error appears:
Log Name: Application Source: Microsoft-Windows-IIS-W3SVC-WP Event ID: 2299 Level: Error Description: An application has reported as being unhealthy. The worker process will now request a recycle. Reason given: An error message detailing the cause of this specific request failure can be found in the application event log of the web server. Please review this log entry to discover what caused this error to occur. . The data is the error. |
Obviously the above information could not lead us to the cause.
Another finding is that all ASP.NET 2.0 applications on this server are working fine. The problem only occurs for .NET 4.0.
Troubleshooting
At first I tried to start to troubleshoot from the error code “0x80070002” with Process Monitor. And I also tried to use Failed Request Tracing.
I could not identify the cause with various tools until I had to initiate a live debugging session. Let us move to Root Cause directly.
Root Cause
Although the .NET 4.0 was installed on this computer, the version of %windir%\system32\mscoree.dll was still v2.0. It should be replaced with v4.0.
It loads .NET 2.0 runtime mscorwks.dll, not the .NET 4.0 runtime clr.dll. Therefore some unexpected behaviors occur during the CLR initialization that causes the worker process to be recycled.
Resolution
You can reinstall .NET 4.0 or re-apply Windows 2008 R2 SP1 to update mscoree.dll.
Conclusion
“HTTP Error 500.0 - Internal Server Error” from AspNetInitClrHostFailureModule means something wrong during the CLR initialization. We need to check the version of %windir%\system32\mscoree.dll.
Regards,
XinJin from GBSD DSI Team