Today I had a problem with IIS7 on Vista while testing and ran into an elusive problem that I thought I'd share the solution to. I created a new Website and a new corresponding Application Pool and started receiving the following error message in the browser when visiting the site: "HTTP Error 500.0 – Internal Server Error"
As usual it was followed by the normal additional error text on the page but nothing useful was there. I found the following two event log entries were also created:
Failed to initialize the AppDomain:/LM/W3SVC/0/ROOT
Exception: System.ArgumentException
Message: Value does not fall within the expected range.
StackTrace: at System.Web.Hosting.IProcessHostSupportFunctions.GetConfigToken(String appId)
at System.Web.Hosting.ISAPIApplicationHost.System.Web.Hosting.IApplicationHost.GetConfigToken()
at System.Web.Hosting.ApplicationManager.CreateAppDomainWithHostingEnvironment(String appId, IApplicationHost appHost, HostingEnvironmentParameters hostingParameters)
at System.Web.Hosting.ApplicationManager.CreateAppDomainWithHostingEnvironmentAndReportErrors(String appId, IApplicationHost appHost, HostingEnvironmentParameters hostingParameters)
followed by:
An error occurred while trying to start an integrated application instance.
Exception: System.ArgumentException
Message: Value does not fall within the expected range.
StackTrace: at System.Web.Hosting.IProcessHostSupportFunctions.GetConfigToken(String appId)
at System.Web.Hosting.ISAPIApplicationHost.System.Web.Hosting.IApplicationHost.GetConfigToken()
at System.Web.Hosting.ApplicationManager.CreateAppDomainWithHostingEnvironment(String appId, IApplicationHost appHost, HostingEnvironmentParameters hostingParameters)
at System.Web.Hosting.ApplicationManager.CreateAppDomainWithHostingEnvironmentAndReportErrors(String appId, IApplicationHost appHost, HostingEnvironmentParameters hostingParameters)
at System.Web.Hosting.ApplicationManager.GetAppDomainWithHostingEnvironment(String appId, IApplicationHost appHost, HostingEnvironmentParameters hostingParameters)
at System.Web.Hosting.ApplicationManager.CreateObjectInternal(String appId, Type type, IApplicationHost appHost, Boolean failIfExists, HostingEnvironmentParameters hostingParameters)
at System.Web.Hosting.ProcessHost.StartApplication(String appId, String appPath, Object& runtimeInterface)
Searching Google for this information revealed nothing exactly like my problem and no solutions worked for me. - No it was not permissions!
Creating a fresh new Application Pool, as well as many other small attempts didn't fix the problem either. None of those attempts really made sense anyway, but then again neither does the solution:
Solution
Finally on a whim I tried the following:
- Visit the "Internet Information Services (IIS) Manager".
- Select the site and choose "Advanced Settings..."
- In my case the value for ID is 0.
- I changed that to 100 and restarted the site.