我正在将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不包含servicebus程序集,我的项目都引用servicebus dll的v2,并被设置为CopyLocal。
发布于 2013-07-03 20:53:26
当我将Azure ServiceBus Nuget包更新到2.1版时,这个问题很方便地解决了。
发布于 2013-06-22 03:18:37
为了帮助调试,你能在你的本地机器上确认你的GAC中是否有Microsoft.ServiceBus.dll吗?还要检查该版本是否与您在项目中引用的版本不同。
发布于 2013-06-24 01:32:52
您的项目似乎没有DLL,或者没有它的正确版本。构建应用程序并查看/bin文件夹。如果找到动态链接库(Microsoft.ServiceBus.dll),请检查其版本并确保其匹配(Version=2.0.0.0)。如果您找不到它,它可能在您的全局程序集缓存中。
如果这对您没有帮助,请尝试: 1.在引用属性中设置copylocal = true,以便将DLL复制到输出目录中。2.使用nuget包管理器链接到Microsoft.Servicebus动态链接库。它通常可以解决很多类似的问题。
https://stackoverflow.com/questions/17232602
复制相似问题