这个星期维护服务器发现在应用程序日志里面发现很多由于asp.net 2.0造成的错误提示,跟着还有一个类似于:
未能初始化 AppDomain:/LM/W3SVC/229/Root
Exception: System.IO.FileLoadException
Message: 未能加载文件或程序集“System.Web, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a”或它的某一个依赖项。拒绝访问。
StackTrace: 在 System.Reflection.Assembly._nLoad(AssemblyName fileName, String codeBase, Evidence assemblySecurity, Assembly locationHint, StackCrawlMark& stackMark, Boolean throwOnFileNotFound, Boolean forIntrospection)
在 System.Reflection.Assembly.nLoad(AssemblyName fileName, String codeBase, Evidence assemblySecurity, Assembly locationHint, StackCrawlMark& stackMark, Boolean throwOnFileNotFound, Boolean forIntrospection)
在 System.Reflection.Assembly.InternalLoad(AssemblyName assemblyRef, Evidence assemblySecurity, StackCrawlMark& stackMark, Boolean forIntrospection)
在 System.Reflection.Assembly.InternalLoad(String assemblyString, Evidence assemblySecurity, StackCrawlMark& stackMark, Boolean forIntrospection)
在 System.Activator.CreateInstance(String assemblyName, String typeName, Boolean ignoreCase, BindingFlags bindingAttr, Binder binder, Object[] args, CultureInfo culture, Object[] activationAttributes, Evidence securityInfo, StackCrawlMark& stackMark)
在 System.Activator.CreateInstance(String assemblyName, String typeName)
在 System.AppDomain.CreateInstance(String assemblyName, String typeName)
在 System.AppDomain.CreateInstance(String assemblyName, String typeName)
在 System.Web.Hosting.ApplicationManager.CreateAppDomainWithHostingEnvironment(String appId, IApplicationHost appHost, HostingEnvironmentParameters hostingParameters)
在 System.Web.Hosting.ApplicationManager.CreateAppDomainWithHostingEnvironmentAndReportErrors(String appId, IApplicationHost appHost, HostingEnvironmentParameters hostingParameters)
有关更多信息,请参阅在 http://go.microsoft.com/fwlink/events.asp 的帮助和支持
这样的一个错误提示,这两个是一体的,最开始的时候在网上找了很多解决方案,可是都没有说到点子上,包括重新安装,注册都测试过,没有解决,昨天晚上在一次无意中的维护当中,当时就想未能初始化 AppDomain:/LM/W3SVC/229/Root,提示这个错误,是不是应该关联一个站点,结果就想229会不会是指示IIS进程了,抱着试试看的态度找到IIS标识符为229的站点查看该站点根目录有web.config文件,也有.NET的文件,但是没有给赋予 NETWORK SERVICE用户的权限,而且客户还没有提示错误,是不是由于该站点没有给赋予.NET的权限造成的报错了,想了一下测试下给赋予.NET权限看看。结果一测试,没有报错,问题解决。希望这篇文章送给给我一样的对这个错误束手无策的人们,当然高手就不需要了,我们还是菜鸟!
2009-12-15 下午 03:55:48 回复该留言
太感谢您了 我的网站也是这个问题,以前遇到过很多次这个问题都没有搞定,偶然看到你这个方法 确实有效果