例外“无法加载文件或程序集'消息'或其依赖项之一。” NServiceBus

时间:2011-03-13 22:49:51

标签: nservicebus

我只是想运行一个简单的NServiceBus Pub / Sub示例。基本上,我有pub / sub作为控制台应用程序,当我运行它时,我在子方面得到一个例外。

Exception was unhandled by user code
  Message=Exception when starting endpoint, error has been logged. Reason: Error creating object with name 'NServiceBus.Unicast.UnicastBus' : Error setting property values: PropertyAccessExceptionsException (1 errors); nested PropertyAccessExceptions are: 
[Spring.Core.TypeMismatchException: Cannot convert property value of type [System.Collections.Hashtable] to required type [System.Collections.IDictionary] for property 'MessageOwners'., Inner Exception: System.ArgumentException: Problem loading message assembly: Messages ---> System.IO.FileNotFoundException: Could not load file or assembly 'Messages' or one of its dependencies. The system cannot find the file specified.
File name: 'Messages'
   at System.Reflection.Assembly._nLoad(AssemblyName fileName, String codeBase, Evidence assemblySecurity, Assembly locationHint, StackCrawlMark& stackMark, Boolean throwOnFileNotFound, Boolean forIntrospection)
   at System.Reflection.Assembly.nLoad(AssemblyName fileName, String codeBase, Evidence assemblySecurity, Assembly locationHint, StackCrawlMark& stackMark, Boolean throwOnFileNotFound, Boolean forIntrospection)
   at System.Reflection.Assembly.InternalLoad(AssemblyName assemblyRef, Evidence assemblySecurity, StackCrawlMark& stackMark, Boolean forIntrospection)
   at System.Reflection.Assembly.InternalLoad(String assemblyString, Evidence assemblySecurity, StackCrawlMark& stackMark, Boolean forIntrospection)
   at System.Reflection.Assembly.Load(String assemblyString)
   at NServiceBus.Unicast.UnicastBus.ConfigureMessageOwners(IDictionary owners) in d:\BuildAgent-02\work\20b5f701adefe8f8\src\unicast\NServiceBus.Unicast\UnicastBus.cs:line 1204

看起来我缺少名为“消息”的程序集,但我不确定在哪里可以找到它。

感谢。

2 个答案:

答案 0 :(得分:3)

最有可能是你在UnicastBusConfig中指定了“消息”(可能是从其中一个样本中复制配置而遗留下来的。)

答案 1 :(得分:0)

我不完全是问题所在,但是,您必须确保您的消息类型位于单独的程序集中,并且您的Message类实现了NServiceBus IMessage接口。

此外,你的Pub和Sub都需要引用你的Messages组件(显然你可以调用任何东西,你不必称之为Message)。