【问题标题】:NServiceBus Could not load file or assemblyNServiceBus 无法加载文件或程序集
【发布时间】:2016-01-29 12:56:44
【问题描述】:

当我调用“NServiceBus.Host.exe”时出现以下错误。问题似乎是 itextsharp.dll。我读过我可以使用

"Configure.With(AllAssemblies.Except("itextsharp.dll"))... // 其余的配置"

但我正在使用以下示例,但不确定在哪里添加此属性。

http://docs.particular.net/samples/web/asp-mvc-application/

#

未处理的异常:Magnum.StateMachine.StateMachineException:发生异常 编辑在 Topshelf.Internal.ServiceController1[[NServiceBus.Host.Internal.GenericHo st, NServiceBus.Host, Version=2.6.0.1504, Culture=neutral, PublicKeyToken=9fc386 479f8a226c]] during state Initial while handling OnStart ---> System.Exception: Exception when starting endpoint, error has been logged. Reason: Could not load file or assembly 'file:///D:\dev\MYSITE\MYSITE.EStore\EStore.Server\bin\Debug\itexts harp.dll' or one of its dependencies. Operation is not supported. (Exception fro m HRESULT: 0x80131515) at NServiceBus.Host.Internal.GenericHost.Start() in d:\BuildAgent-02\work\20b 5f701adefe8f8\src\host\NServiceBus.Host\Internal\GenericHost.cs:line 90 at Magnum.StateMachine.EventActionList1.Execute(T stateMachine, Event event, 对象参数)在:line 0 --- 内部异常堆栈跟踪结束 ---

服务器堆栈跟踪: 在 Magnum.StateMachine.ExceptionActionDictionary1.HandleException(T stateMac hine, Event event, Object parameter, Exception exception) in :line 0 at Magnum.StateMachine.EventActionList1.Execute(T stateMachine, 事件事件, 对象参数)在:line 0 在 Magnum.StateMachine.State1.RaiseEvent(T instance, BasicEvent1 事件,Ob 项目值)在:第 0 行 在 Magnum.StateMachine.StateMachine`1.RaiseEvent(引发事件)中:第 0 行 在 System.Runtime.Remoting.Messaging.StackBuilderSink._PrivateProcessMessage( IntPtr md, Object[] args, 对象服务器, Int32 methodPtr, Boolean fExecuteInCont 分机,对象[]& outArgs) 在 System.Runtime.Remoting.Messaging.StackBuilderSink.SyncProcessMessage(IMes sage msg, Int32 methodPtr, Boolean fExecuteInContext)

在 [0] 处重新抛出异常: 在 System.Runtime.Remoting.Proxies.RealProxy.HandleReturnMessage(IMessage 请求 消息,IMessage retMsg) 在 System.Runtime.Remoting.Proxies.RealProxy.PrivateInvoke(消息数据和 msgDa ta,Int32 类型) 在 Topshelf.Internal.ServiceControllerProxy.Start() 在 d:\dev\open-source\topshel 中的 Topshelf.Internal.ServiceCoordinator.Start() f\src\Topshelf\Internal\ServiceCoordinator.cs:第 54 行 在 d:\dev\open-source\topshelf\s 中的 Topshelf.Internal.Hosts.ConsoleHost.Run() rc\Topshelf\Internal\Hosts\ConsoleHost.cs:第 53 行 在 d:\BuildAgent-02\work\20b5 中的 NServiceBus.Host.Program.Main(String[] args) f701adefe8f8\src\host\NServiceBus.Host\Program.cs:103行

【问题讨论】:

    标签: nservicebus


    【解决方案1】:

    当 NserviceBus 主机启动时,它会尝试从您指定的程序集中检索所有类型。 在您提供的示例中,它使用 NServiceBus.Configure.WithWeb() 方法。 这和调用 NServiceBus.Configure.With(AppDomain.CurrentDomain.DynamicDirectory) 是一样的

    您收到异常是因为“itextsharp.dll”无法加载到 AppDomain(这是通过调用 Assembly.LoadFrom(file.FullName) 方法完成的)。

    要解决此问题,您可以使用 NServiceBus.Configure.With() 重载之一手动指定需要扫描的程序集。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2020-08-17
      相关资源
      最近更新 更多