Permissions

ASP.Net / IIS 權限或配置問題

  • November 3, 2012

我們有一個 3 伺服器網路場,在 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_royal -i
  • 給出錯誤:為 C:\WINDOWS\assembly\GAC_32\System.Data\2.0.0.0__b77a5c561934e089\System.Data.dll 生成啟動上下文失敗。參考錯誤消息:訪問被拒絕。

所以我有點卡住了。有任何想法嗎?

問題最終是 GAC 中的權限以某種方式被破壞了。修理:

  1. 註銷shfusion.dllregsvr32 以便您可以訪問c:\windows\assembly
  2. 重置權限,以便網路服務可以訪問 GAC
  3. 重新註冊shfusion.dll

為了更好地衡量,還執行aspnet_regiis.exe -ga "UserAccount"以修復 IIS 元數據庫權限。

引用自:https://serverfault.com/questions/342193