我的WebRole无法启动但会不断重启并抛出此异常:
Application: WaIISHost.exe
Framework Version: v4.0.30319
Description: The process was terminated due to an unhandled exception.
Exception Info:
System.IO.FileLoadException: Could not load file or assembly 'Autofac, Version=3.4.0.0, Culture=neutral, PublicKeyToken=17863af14b0044da' or one of its dependencies. The located assembly's manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040)
File name: 'Autofac, Version=3.4.0.0, Culture=neutral, PublicKeyToken=17863af14b0044da'
at MyDomain.Web.AutofacWebModule.Load(ContainerBuilder builder)
at Autofac.Module.Configure(IComponentRegistry componentRegistry)
at Autofac.ContainerBuilder.Build(IComponentRegistry componentRegistry, Boolean excludeDefaultModules)
at Autofac.ContainerBuilder.Build(ContainerBuildOptions options)
at MyDomain.Web.Startup.BuildAutofacContainer() in MyDomain.Web\Startup.cs:line 82
at MyDomain.Web.WebRole.Run() in MyDomain.Web\WebRole.cs:line 25
at Microsoft.WindowsAzure.ServiceRuntime.RoleEnvironment.StartRoleInternal()
at Microsoft.WindowsAzure.ServiceRuntime.Implementation.Loader.RoleRuntimeBridge.<StartRole>b__2()
at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
at System.Threading.ThreadHelper.ThreadStart()
更新。在本文的帮助下添加了完整的错误说明: Troubleshooting Scenario 7 – Role Recycling
更新2.找到一篇关于异常的好文章。 Cloud Services roles recycling with the error “System.IO.FileLoadException: Could not load file or assembly”。这似乎足以解决问题。
它中断的原因是我的Azure实例,在E:\approot\bin\
中没有MyDomain.Web.config
个文件,其中包含Autofac所需的重定向。 web.config
无法读取E:\approot\
中的WaIISHost.exe
。它就这样打破了。
答案 0 :(得分:0)
它需要将mHandler.removeCallbacks(runnable);
文件添加到解决方案(与web.config或app.config相同的级别)(将“复制到输出目录”属性设置为“始终复制”)。然后重新部署到Azure。此文件应包含<role name>.dll.config
设置。