我刚刚为我的项目设置了一个持续部署构建(使用 azure TFS 服务又名 visualstudio.com),但它不能正常工作。构建似乎很好,部署开始了,但我的工人角色总是不断地回收。我在通过管理门户部署的 Visual Studio 中的手动构建工作正常。当我远程访问其中一个工作虚拟机以查看发生了什么时,我在事件日志中发现了这一点:
An unhandled exception occurred. Type: Autofac.Core.DependencyResolutionException Process ID: 2488
Process Name: WaWorkerHost
Thread ID: 13
AppDomain Unhandled Exception for role MyProject.Worker_IN_1
Exception: An exception was thrown while invoking the constructor 'Void .ctor(Microsoft.WindowsAzure.CloudStorageAccount)' on type 'TemplateRepository'.
at MyProject.Worker.WorkerRole.Run() in c:\a\src\MyProject\Dev\MyProject.Worker\WorkerRole.cs:line 383
at Microsoft.WindowsAzure.ServiceRuntime.RoleEnvironment.StartRoleInternal()
at Microsoft.WindowsAzure.ServiceRuntime.Implementation.Loader.RoleRuntimeBridge.<startrole>b__1()
at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean ignoreSyncCtx)
at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
at System.Threading.ThreadHelper.ThreadStart()
Inner Exception: The type initializer for 'Microsoft.WindowsAzure.ServiceRuntime.RoleEnvironment' threw an exception.
at Microsoft.WindowsAzure.ServiceRuntime.RoleEnvironment.GetConfigurationSettingValue(String configurationSettingName)
at MyProject.Worker.Core.Repositories.TemplateRepository..ctor(CloudStorageAccount account) in c:\a\src\MyProject\Dev\MyProject.Worker.Core\Repositories\TemplateRepository.cs:line 24
at lambda_method(Closure , Object[] )
at Autofac.Core.Activators.Reflection.ConstructorParameterBinding.Instantiate()
Inner Exception: Could not load file or assembly 'msshrtmi, Version=1.8.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' or one of its dependencies. The located assembly's manifest definition does not match the assembly reference. (Exception from HRESULT:
0x80131040)
at Microsoft.WindowsAzure.ServiceRuntime.RoleEnvironment.InitializeEnvironment()
at Microsoft.WindowsAzure.ServiceRuntime.RoleEnvironment..cctor()
似乎出于某种原因,在 TFS 构建服务器上执行的构建最终错误地引用了 msshrtmi 的 1.8 版,而不是 1.7(这是我所有项目实际引用的)。我尝试添加对 msshrtmi 的显式引用,并且还尝试了在此处找到的建议 (http://tomkrueger.wordpress.com/2010/07/27/azure-deployment-issue-after-upgrading-to-visual-studio- 2010-and-net-4-0/) 似乎都没有工作。
还有其他建议吗?
更新:这是我在 MSDN 论坛上的交叉帖子的链接