FileLoadException:未能加载文件或程序中WebRole(循环实例) [英] FileLoadException: Could not load file or assembly in WebRole (recycling instance)

查看:589
本文介绍了FileLoadException:未能加载文件或程序中WebRole(循环实例)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我WebRole将无法启动,但不断重新启动,并抛出这个异常:

My WebRole won't start but keeps restarting and throws this exception:

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()

更新。加入本文的帮助下完整的错误描述:
故障排除方案7 - 角色回收

UPDATE. Added a full error description with the help of this article: Troubleshooting Scenario 7 – Role Recycling

更新2.发现有关异常的好文章。 <一href=\"https://blogs.msdn.microsoft.com/cie/2015/09/06/cloud-services-roles-recycling-with-the-error-system-io-fileloadexception-could-not-load-file-or-assembly/#comment-1503\"相对=nofollow>云服务角色的错误回收System.IO.FileLoadException:无法加载文件或程序。这似乎足以解决问题。

UPDATE 2. Found a good article about the exception. Cloud Services roles recycling with the error "System.IO.FileLoadException: Could not load file or assembly". It seems to be enough to fix the problem.

它打破的原因是我的Azure实例,在 E:\\为approot \\ BIN \\ 没有 MyDomain.Web.config 与Autofac所需的重定向文件。和的web.config E:\\为approot \\ 不受 WaIISHost读取。 exe文件。所以,它打破了。

The reason it breaks is on my Azure instance, in E:\approot\bin\ there is no MyDomain.Web.config files with the redirections required by Autofac. And the web.config in E:\approot\ is not read by the WaIISHost.exe. And so it breaks.

推荐答案

它需要的&LT;角色名称&gt; .dll.config 文件加入到溶液(同一水平在web.config或app.config)中(复制到输出目录属性设置为一直拷贝)。然后再重新部署到Azure上。该文件应包含 bindingRedirect 设置。

It needed the <role name>.dll.config file added to solution (same level as the web.config or app.config) (the Copy to Output Directory property to "Copy Always"). Then redeploying to Azure. This file should contain the bindingRedirect settings.

这篇关于FileLoadException:未能加载文件或程序中WebRole(循环实例)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆