You may experience “The configuration system has already been initialized” exception after installing the KB2844285
Background
Recently we have several cases related to the KB2844285 (MS13-052: Description of the security update for the .NET Framework 2.0 Service Pack 2 on Windows XP and Windows Server 2003: July 9, 2013). Customer reported that some of the web applications failed to work with the following exceptions in event logs:
Event Type: Error
Event Source: ASP.NET 2.0.50727.0
Event Category: None
Event ID: 1334
Date: 7/18/2013
Time: 5:32:36 AM
User: N/A
Computer: XXXXXINET30
Description:
Failed to initialize the AppDomain:/LM/W3SVC/1/ROOT
Exception: System.InvalidOperationException
Message: The configuration system has already been initialized.
StackTrace: at System.Configuration.ConfigurationManager.SetConfigurationSystem(IInternalConfigSystem configSystem, Boolean initComplete)
at System.Configuration.Internal.InternalConfigSettingsFactory.System.Configuration.Internal.IInternalConfigSettingsFactory.SetConfigurationSystem(IInternalConfigSystem configSystem, Boolean initComplete)
at System.Web.Configuration.HttpConfigurationSystem.EnsureInit(IConfigMapPath configMapPath, Boolean listenToFileChanges, Boolean initComplete)
at System.Web.Hosting.HostingEnvironment.Initialize(ApplicationManager appManager, IApplicationHost appHost, IConfigMapPathFactory configMapPathFactory, HostingEnvironmentParameters hostingParameters)
at System.Web.Hosting.HostingEnvironment.Initialize(ApplicationManager appManager, IApplicationHost appHost, IConfigMapPathFactory configMapPathFactory, HostingEnvironmentParameters hostingParameters)
at System.Web.Hosting.ApplicationManager.CreateAppDomainWithHostingEnvironment(String appId, IApplicationHost appHost, HostingEnvironmentParameters hostingParameters)
at System.Web.Hosting.ApplicationManager.CreateAppDomainWithHostingEnvironmentAndReportErrors(String appId, IApplicationHost appHost, HostingEnvironmentParameters hostingParameters)
The interesting thing is not all of the web servers failed to work after installing the KB2844285, but only some of the web servers were impacted.
Troubleshooting
As we know, the above exception is usually thrown out while multi-version .Net Framework dll being loaded to the same W3WP.exe process unexpectedly.
Based on the metabase.xml, the above impacted websites are configured to running under .Net Framework V2.0, but Process Monitor log indicated that the above websites (W3WP.exe processes) did try to load .Net Framework 4.0 version dll while the problem occurred.
5:31:32.6327962 AM w3wp.exe 19128 Load Image C:\WINDOWS\Microsoft.NET\Framework\v4.0.30319\aspnet_filter.dll SUCCESS Image Base: 0x600c0000, Image Size: 0x8000
5:31:33.8998725 AM w3wp.exe 19128 Load Image C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\aspnet_isapi.dll SUCCESS Image Base: 0x60070000, Image Size: 0x5000
5:31:34.0055090 AM w3wp.exe 19128 Load Image C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\webengine.dll SUCCESS Image Base: 0x6a2a0000, Image Size: 0x6d000
5:31:34.2439321 AM w3wp.exe 19128 Load Image C:\WINDOWS\Microsoft.NET\Framework\v4.0.30319\mscoreei.dll SUCCESS Image Base: 0x603b0000, Image Size: 0x66000
……
Root Cause
Still with the help of Process Monitor, we clarified that it is due to the AVIcode (AVIcode .NET Application Monitoring) module PerfMon.dll loaded the 4.0 version .Net Framework unexpectedly:
0 ntkrnlpa.exe ntkrnlpa.exe + C:\WINDOWS\system32\ntkrnlpa.exe
1 ntkrnlpa.exe ntkrnlpa.exe + C:\WINDOWS\system32\ntkrnlpa.exe
……
6 ntdll.dl ntdll.dll + C:\WINDOWS\system32\ntdll.dll
7 advapi32.dll advapi32.dll + C:\WINDOWS\system32\advapi32.dll
8 advapi32.dll advapi32.dll + C:\WINDOWS\system32\advapi32.dll
9 mscoreei.dll mscoreei.dll + C:\WINDOWS\Microsoft.NET\Framework\v4.0.30319\mscoreei.dll
10 mscoreei.dll mscoreei.dll + C:\WINDOWS\Microsoft.NET\Framework\v4.0.30319\mscoreei.dll
11 mscoreei.dll mscoreei.dll + C:\WINDOWS\Microsoft.NET\Framework\v4.0.30319\mscoreei.dll
12 mscoree.dll mscoree.dll + C:\WINDOWS\system32\mscoree.dll
13 PerfMon.dll PerfMon.dll + C:\Program Files\ AVIcode\Intercept\Agent\v5.6.248\PerfMon.dll
Solution
We can uncheck “Enable Monitoring” feature in “Intercept Management Console” of AVIcode as a temporarily workaround.
We also find that on the working servers AVIcode version is 5.7, while on the broken server AVIcode version is 5.6. After upgrading AVIcode from 5.6 to 5.7 on the broken servers, the problem is resolved completely.
Regards,
YongKang Chen from DSI Team