2
votes

I am just trying to run a simple NServiceBus Pub/Sub example. Basically, I have pub/sub as console apps and when i run them I am getting an exception on sub side.

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

Looks like I am missing assembly called "Messages", but I am not sure where I could find it.

Thanks.

2

2 Answers

3
votes

It's most likely that you have "Messages" specified in the UnicastBusConfig (maybe left over from copying the config from one of the samples).

0
votes

I'm not exactly what the issue is, HOWEVER, you must make sure that your Message Types are in a separate assembly, and that your Message classes Implement the NServiceBus IMessage Interface.

Also, both your Pub and Sub need to reference your Messages assembly (which you can call anything obviously, you don't have to call it Messages).