我正在将 azure 服务总线功能实现到客户端 asp.net webforms 解决方案中。
工作人员角色定期轮询总线以获取新消息,并且为现有的 webforms 应用程序定义了一个 Web 角色,该角色负责将消息添加到总线队列中。
每当我尝试在本地运行该应用程序时,由于 Microsoft.ServiceBus 程序集与预期不匹配而出现错误...
System.IO.FileLoadException was unhandled
HResult=-2146234304
Message=Could not load file or assembly 'Microsoft.ServiceBus, Version=2.0.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)
Source=Azure.EnquiryWorker
FileName=Microsoft.ServiceBus, Version=2.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35
FusionLog==== Pre-bind state information ===
LOG: User = *Omitted*
LOG: DisplayName = Microsoft.ServiceBus, Version=2.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35
(Fully-specified)
LOG: Appbase = file:///C:/Users/*path omitted*/*project name omitted*/csx/Debug/roles/Azure.EnquiryWorker/approot
LOG: Initial PrivatePath = C:\Users\*path omitted*/*project name omitted*\csx\Debug\roles\Azure.EnquiryWorker\approot
Calling assembly : Azure.EnquiryWorker, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null.
===
LOG: This bind starts in default load context.
LOG: Using application configuration file: C:\Users\*path omitted*/*project name omitted*\csx\Debug\roles\Azure.EnquiryWorker\approot\Azure.EnquiryWorker.dll.config
LOG: Using host configuration file:
LOG: Using machine configuration file from C:\Windows\Microsoft.NET\Framework64\v4.0.30319\config\machine.config.
LOG: Post-policy reference: Microsoft.ServiceBus, Version=2.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35
LOG: Attempting download of new URL file:///C:/Users/*path omitted*/*project name omitted*/csx/Debug/roles/Azure.EnquiryWorker/approot/Microsoft.ServiceBus.DLL.
WRN: Comparing the assembly name resulted in the mismatch: Minor Version
ERR: Failed to complete setup of assembly (hr = 0x80131040). Probing terminated.
StackTrace:
at Azure.EnquiryWorker.WorkerRole.OnStart()
at Microsoft.WindowsAzure.ServiceRuntime.RoleEnvironment.InitializeRoleInternal(RoleType roleTypeEnum)
at Microsoft.WindowsAzure.ServiceRuntime.RoleEnvironment.InitializeRole(RoleType roleType)
at Microsoft.WindowsAzure.ServiceRuntime.Implementation.Loader.RoleRuntimeBridge.<InitializeRole>b__0()
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()
InnerException:
webforms 应用程序在 bin 文件夹中有 serviceBus dll(作为间接引用添加,因为服务总线代码位于库项目中)。
GAC 不包含服务总线程序集,我的项目都引用了服务总线 dll 的 v2,并设置为 CopyLocal。