NServiceBus无法加载文件或程序集

时间:2011-12-09 17:31:59

标签: nservicebus

当我调用“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.ServiceController 1[[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.EventActionList中编辑1.Execute(T stateMachine,事件事件,  对象参数):第0行    ---内部异常堆栈跟踪结束---

服务器堆栈跟踪:    在Magnum.StateMachine.ExceptionActionDictionary 1.HandleException(T stateMac hine, Event event, Object parameter, Exception exception) in :line 0 at Magnum.StateMachine.EventActionList 1.Execute(T stateMachine,事件事件,  对象参数):第0行    在Magnum.StateMachine.State 1.RaiseEvent(T instance, BasicEvent 1 eevent,Ob ject value)in:第0行    在Magnum.StateMachine.StateMachine`1.RaiseEvent(Event raise)in:第0行    在System.Runtime.Remoting.Messaging.StackBuilderSink._PrivateProcessMessage( IntPtr md,Object [] args,Object server,Int32 methodPtr,Boolean fExecuteInCont ext,Object []& outArgs)    在System.Runtime.Remoting.Messaging.StackBuilderSink.SyncProcessMessage(IMes sage msg,Int32 methodPtr,Boolean fExecuteInContext)

在[0]处重新抛出异常:    在System.Runtime.Remoting.Proxies.RealProxy.HandleReturnMessage(IMessage req) Msg,IMessage retMsg)    在System.Runtime.Remoting.Proxies.RealProxy.PrivateInvoke(MessageData& 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行

1 个答案:

答案 0 :(得分:4)

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

相同

你得到了解雇,因为“itextsharp.dll”无法加载到AppDomain(这是通过调用Assembly.LoadFrom(file.FullName)方法完成的。)

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