gpt4 book ai didi

nservicebus - 通过 NServiceBus.Host.exe 启动端点时出现异常

转载 作者:行者123 更新时间:2023-12-04 05:08:25 24 4
gpt4 key购买 nike

我正在开发一个在 .NET 4.5 项目中使用 NServiceBus 的示例消息处理程序服务。只要使用 DefaultBuilder,它就可以正常工作。要在添加对 Autofac 的引用并将 DefaultBuilder 更改为 AutofacBuilder 后立即使用 Autofac 为其他服务配置容器,我得到如下所示的异常。对 NServiceBus.ObjectBuilder.Autofac.dll 的引用已经在项目中。

Exception when starting endpoint, error has been logged. Reason: Could not load file or assembly 'Autofac, Version=2.6.1.841, 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)

WRN: Comparing the assembly name resulted in the mismatch: Major Version
ERR: Failed to complete setup of assembly (hr = 0x80131040). Probing terminated.



我究竟做错了什么?我已经尝试过 Nuget,手动引用,将目标框架更改为 4.0。

编辑

添加绑定(bind)重定向后,错误消息更改为
Method not found: 'Autofac.Builder.IRegistrationBuilder`3<!0,!1,!2>
Autofac.Builder.IRegistrationBuilder`3.PropertiesAutowired(Autofac.PropertyWiringFlags)'.

at NServiceBus.Hosting.GenericHost.Start() in c:\BuildAgent\work\nsb.master_6\src\hosting\NServiceBus.Hosting\GenericHost.cs:line 43
at NServiceBus.Hosting.Windows.WindowsHost.Start() in c:\BuildAgent\work\nsb.master_6\src\hosting\NServiceBus.Hosting.Windows\WindowsHost.cs:line 55
at NServiceBus.Hosting.Windows.Program.<>c__DisplayClass8.<Main>b__4(WindowsHost service) in c:\BuildAgent\work\nsb.master_6\src\hosting\NServiceBus.Hosting.Windows\Program.cs:line 97
at Topshelf.Internal.ControllerDelegates`1.StartActionObject(Object obj) in c:\Projects\TopShelfForNSB\src\Topshelf\Internal\ControllerDelegates.cs:line 17
at Topshelf.Internal.IsolatedServiceControllerWrapper`1.<>c__DisplayClass2.<set_StartAction>b__1(TService service) in c:\Projects\TopShelfForNSB\src\Topshelf\Internal\IsolatedServiceControllerWrapper.cs:line 65
at Topshelf.Internal.ServiceController`1.<.cctor>b__1(ServiceController`1 sc) in c:\Projects\TopShelfForNSB\src\Topshelf\Internal\ServiceController.cs:line 35
at Magnum.StateMachine.LambdaAction`1.Execute(T instance, Event event, Object parameter) in :line 0
at Magnum.StateMachine.EventActionList`1.Execute(T stateMachine, Event event, Object parameter) in :line 0

应用配置
<runtime>
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
<dependentAssembly>
<assemblyIdentity name="Autofac" publicKeyToken="17863af14b0044da" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-3.0.0.0" newVersion="3.0.0.0" />
</dependentAssembly>
</assemblyBinding>
</runtime>

最佳答案

NServiceBus v3.3.5 使用 Autofac v2.6.1.841,如果您引用不同的版本,则需要添加绑定(bind)重定向。

关于nservicebus - 通过 NServiceBus.Host.exe 启动端点时出现异常,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/15210759/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com