ASP.Net/IIS 权限或配置问题

ASP.Net/IIS 权限或配置问题

我们有一个由 3 台服务器组成的 Web 场,在 IIS6、Windows Server 2003 上运行 ASP.Net 3.5 应用程序。我们刚刚安装了应用程序的更新,三台服务器中的两台运行正常,但第三台服务器立即开始出现问题。尝试启动网站时,我们在日志中看到此异常:

System.IO.FileLoadException: Could not load file or assembly 'System.EnterpriseServices.Wrapper.dll' or one of its dependencies. This application has failed to start because the application configuration is incorrect. Reinstalling the application may fix this problem. (Exception from HRESULT: 0x800736B1)
File name: 'System.EnterpriseServices.Wrapper.dll' ---> System.Runtime.InteropServices.COMException (0x800736B1): This application has failed to start because the application configuration is incorrect. Reinstalling the application may fix this problem. (Exception from HRESULT: 0x800736B1)
   at System.Reflection.Assembly._nGetModules(Boolean loadIfNotFound, Boolean getResourceModules)
   at System.Reflection.Assembly.nGetModules(Boolean loadIfNotFound, Boolean getResourceModules)
   at System.Reflection.Assembly.GetTypes()
   at System.Web.Mvc.ControllerTypeCache.GetAllControllerTypes(IBuildManager buildManager)
   at System.Web.Mvc.ControllerTypeCache.EnsureInitialized(IBuildManager buildManager)
   at System.Web.Mvc.DefaultControllerFactory.GetControllerTypeWithinNamespaces(String controllerName, HashSet`1 namespaces)
   at System.Web.Mvc.DefaultControllerFactory.GetControllerType(String controllerName)
   at System.Web.Mvc.DefaultControllerFactory.CreateController(RequestContext requestContext, String controllerName)
   at System.Web.Mvc.MvcHandler.ProcessRequest(HttpContextBase httpContext)
   at System.Web.Mvc.MvcHandler.ProcessRequest(HttpContext httpContext)
   at System.Web.Mvc.MvcHandler.System.Web.IHttpHandler.ProcessRequest(HttpContext httpContext)
   at System.Web.HttpApplication.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute()
   at System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously)

从那时起:

System.Runtime.InteropServices.COMException (0x800736B1): This application has failed to start because the application configuration is incorrect. Reinstalling the application may fix this problem. (Exception from HRESULT: 0x800736B1)
   at System.Reflection.Assembly._nGetModules(Boolean loadIfNotFound, Boolean getResourceModules)
   at System.Reflection.Assembly.nGetModules(Boolean loadIfNotFound, Boolean getResourceModules)
   at System.Reflection.Assembly.GetTypes()
   at System.Web.Mvc.ControllerTypeCache.GetAllControllerTypes(IBuildManager buildManager)
   at System.Web.Mvc.ControllerTypeCache.EnsureInitialized(IBuildManager buildManager)
   at System.Web.Mvc.DefaultControllerFactory.GetControllerTypeWithinNamespaces(String controllerName, HashSet`1 namespaces)
   at System.Web.Mvc.DefaultControllerFactory.GetControllerType(String controllerName)
   at System.Web.Mvc.DefaultControllerFactory.CreateController(RequestContext requestContext, String controllerName)
   at System.Web.Mvc.MvcHandler.ProcessRequest(HttpContextBase httpContext)
   at System.Web.Mvc.MvcHandler.ProcessRequest(HttpContext httpContext)
   at System.Web.Mvc.MvcHandler.System.Web.IHttpHandler.ProcessRequest(HttpContext httpContext)
   at System.Web.HttpApplication.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute()
   at System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously)

到目前为止我已经尝试过:

  1. 重新启动 IIS
  2. 重启服务器
  3. 重新安装 .net 框架
  4. 将 EnterpriseServices.dll 和 EnterpriseServices.Wrapper.dll 复制到 html/bin 目录
  5. 运行 aspnet_regiis -i
    • 给出错误:为 C:\WINDOWS\assembly\GAC_32\System.Data\2.0.0.0__b77a5c561934e089\System.Data.dll 生成激活上下文失败。参考错误消息:访问被拒绝。

所以我有点困惑。有什么想法吗?

答案1

问题最终是因为 GAC 中的权限不知何故被破坏了。解决方法:

  1. 使用 regsvr32取消注册shfusion.dll,以便您可以访问c:\windows\assembly
  2. 重置权限以便网络服务可以访问 GAC
  3. 重新注册shfusion.dll

为了确保万无一失,还运行aspnet_regiis.exe -ga "UserAccount"修复 IIS 元数据库权限。

相关内容