Background:
- I have two NServiceBus endpoint projects in my solution.
- Both are NServiceBus subscribers and contain a message handler to one message.
- Each subscriber project handles a message from one of two different publishers. As such, one project references a messages DLL from one publisher, and the other references a messages DLL from the other publisher.
- Both publishers are external to my solution.
- Apart from the messages DLLs, both subscriber projects reference the same binaries for NServiceBus, and additionally have the exact same setup (UnicastBusConfig, EndpointConfig, appSettings, etc)
One subscriber project runs fine, but the other one fails with this error:
Unhandled Exception: System.InvalidOperationException: No endpoint configuration found in scanned assemblies. This usually happens when NServiceBus fails to load your assembly contaning IConfigureThisEndpoint. Try specifying the type explicitly in the NServiceBus.Host.exe.config using the appsetting key: EndpointConfigurationTypeScanned path: my path here
at NServiceBus.Host.Program.ValidateEndpoints(IEnumerable`1 endpointConfigurationTypes)
at NServiceBus.Host.Program.GetEndpointConfigurationType()
at NServiceBus.Host.Program.Main(String[] args)
My suspicion is that the problem must lie with the NServiceBus publisher messages DLL of the subscriber which is failing to start up. Howerver, I am not sure how to work out what is wrong with this. I have looked at:
- both the NServiceBus publishers messages DLL's manifests using ildasm and they are identical (with regards to processor flags and NServiceBus DLL versions referenced).
- the NSB messages projects, which were both built with .Net 3.5 Framework.
I am going insane here and have burned almost a day trying to get this working. Any help would be massively appreciated.
Best Answer
Well, the exception tells you exactly what it is about. It is looking for some class that implements IConfigureThisEndpoint.
Three things come to my mind:
The NServiceBus.Host.exe.config file should look like this:
I think that the "No endpoint config..." exception seems to be thrown for lots of different reasons, and it kind of masks the actual reason. Anyone know a nice way of diagnosing these kind of problems?
The last point happend to me, too. It happended after renaming my assembly and not cleaning the project directory. NServiceBus then ran through all files and found both the old named assembly AND the new named assembly and ended with the same exception.
Please note that this also happens if the second assembly containing the same interface implementation may cause tis error if it is located inside a subfolder. This behaviour had caused me some debugging headaches as I previously had copied my file to a subfolder as a short term backup...
[Edit]
Edited to add the additional items by the other authors in this thread for completeness.
[EDIT 2]
Added more information about
NServiceBus.Host.exe.config
.