Wednesday, January 11, 2006

CS0007: Unexpected common language runtime initialization error -- 'Catastrophic failure '

Update: apparently, the reason why this error occurred was that my system had some security lockdown permission changes which conflicted with the list of patches below..hence the need to make those permissions changes in steps 4 and 5 below. Harumph.

Argh. One of the recent set of MS security hotfixes has broken ASP.net with the following error:
CS0007: Unexpected common language runtime initialization error -- 'Catastrophic failure '

I upgraded my Win2K server with the following patches:
KB905915 IE6 SP1
KB902400 2K
KB908523 2K
KB912919 2K
KB891861 2K SP4 Rollup
KB890830 Dec Malware Removal

I've found a workaround here:
http://www.iis-resources.com/modules/newbb/viewtopic.php?topic_id=4246&forum=4

Here is the text of the workaround:
PROBLEM
========
Running ASP.NET application was giving
Compiler Error Message: CS0007: Unexpected common language runtime initialization error -- 'Catastrophic failure'
RESOLUTION
============
There were some problems with the permission on the aspnet account. Later we found that EVERYONE group was missing READ permission on c:\windows\registration folder. Below given are the steps to check the permissions of aspnet account at various places.
Following are Generic Steps that we can take to fix the various issues related to ASP.NET that you are seeing on different Windows 2000 SP4 boxes which we believe is happening because of the security patches you installed.

Please make sure that the ASPX pages run under SYSTEM account before proceeding further with following steps
Steps 1 and 2 would make sure that you get rid of event id: 1007 and 1084
Follow Step 3 if you are getting if you are getting "Compiler Error Message: BC32400: Class 'CLSID_CorSysWrite_SxS could not be created 'Catastrophic failure'
Steps 4 and 5 are for "Compiler Error Message: CS0007: Unexpected common runtime initialization error -- 'Catastrophic failure'"

1. Running ASPNetRegIIS –ua followed by ASPNetRegIIS –i from the framework folder.

2. Make sure that ASPNET account has got permission as per following matrix
Location Access type Account Comments installroot\ASP.NET Temporary Files Read/write Process or configured impersonation. This is the location for dynamically compiled files. Beneath this location, application code generation takes place in a discrete directory for each application. The root location itself can be configured using the tempDir attribute of the section. systemroot\assembly Read Process or configured impersonation. This is the location of the global assembly cache. systemroot\system32 R Process Contains system DLLs loaded by the .NET Framework. systemroot\temp Read/write/delete Process Used for web services support. userprofile directory Read/write Process Used by the global assembly cache lock files and the common language runtime security configuration caching mechanism. If the user profile directory for the account doesn't exist, ASP.NET will use the default userprofile directory.application directory Read Process or configured impersonation. This is the location for application files. installroot hierarchy Read Process or configured impersonation ASP.NET must be able to access the system assemblies referenced in the Machine.config file in the config subdirectory under installroot. Default Web Site monitoring. Read Process Used for file change notification monitoring
3 Make sure that ASPNET account has got read permission on following keys
HKCR\CLSID\{0AE2DEB0-F901-478B-BB9F-881EE8066788}
HKCR\CLSID\{0A29FF9E-7F9C-4437-8B11-F424491E3931}
HKCR\CLSID\{0C7FF16C-38E3-11d0-97AB-00C04FC2AD98
4. In the %windir%/registration folder, make sure that the Everyone group has READ permissions.
- In the advanced security properties of the .clb files in the %windir%/registration folder, make sure that the Inherit from parent the permission entries that apply to child objects. Include these with entries explicitly defined here option is selected.
- Make sure that the Everyone group has one of the following permissions: Traverse permissions (“List Folder Contents”) on all parent directories (%systemdrive%, %windir%, and %windir%\registration), or The Bypass Traverse Checking permission is selected.
5. Running RegSvr32.EXE mscoree.dll from the C:\winnt\system32

No comments:

Feel free to drop me a line or ask me a question.