Failed to execute request because the App-Domain could not be created解决办法
打开ASP.NET网站时,如果发生错误, 查看"事件查看器" 中的记录,如果发现警告信息:
"Failed to execute request because the App-Domain could not be created. Error: 0x80131902"
未能初始化 AppDomain:/LM/W3SVC/1/ROOT
Exception: System.Configuration.ConfigurationErrorsException
Message: 引发类型为“System.Configuration.ConfigurationErrorsException”的异常。
StackTrace: 在 System.Web.Configuration.ErrorRuntimeConfig.ErrorConfigRecord.System.Configuration.Internal.IInternalConfigRecord.GetLkgSection(String configKey)
在 System.Web.Configuration.RuntimeConfigLKG.GetSectionObject(String sectionName)
在 System.Web.Configuration.RuntimeConfig.GetSection(String sectionName, Type type, ResultsIndex index)
在 System.Web.Configuration.RuntimeConfig.get_HostingEnvironment()
在 System.Web.Hosting.HostingEnvironment.StartMonitoringForIdleTimeout()
在 System.Web.Hosting.HostingEnvironment.Initialize(ApplicationManager appManager, IApplicationHost appHost, IConfigMapPathFactory configMapPathFactory, HostingEnvironmentParameters hostingParameters)
在 System.Web.Hosting.HostingEnvironment.Initialize(ApplicationManager appManager, IApplicationHost appHost, IConfigMapPathFactory configMapPathFactory, HostingEnvironmentParameters hostingParameters)
在 System.Web.Hosting.ApplicationManager.CreateAppDomainWithHostingEnvironment(String appId, IApplicationHost appHost, HostingEnvironmentParameters hostingParameters)
在 System.Web.Hosting.ApplicationManager.CreateAppDomainWithHostingEnvironmentAndReportErrors(String appId, IApplicationHost appHost, HostingEnvironmentParameters hostingParameters)
基本上,这个情況最可能fa生在第一次執行 .Net framework 2.0 ,原因不明,但底下的做法大致可以解決此问题:
1.首先开启「命令窗口」, cd C:/Windows/Microsoft.Net/Framework/
2.在命令行 "net stop w3svc"
3. cd C:/Windows/Microsoft.Net/Framework/v2.0.50727/
4. "aspnet_regiis.exe -ua"
5.重新安裝 .Net 到 IIS 中 执行 "aspnet_regiis.exe -i"
6.cd C:/Windows/Microsoft.Net/Framework/
7.重新启 w3svc 执行 "net start w3svc".
OK...