I created a new launch class as follows:
public class NonWebRunAtStartup : IRunAtStartup { public void InitializeInfrastructure(object container) { Configure.With() .StructureMapBuilder((IContainer) container) .Log4Net() .XmlSerializer() .MsmqTransport() .UnicastBus() .LoadMessageHandlers() .CreateBus() .Start(); } }
Then, in my test, I made sure that my IOC container would use this instead of the regular web interface by adding this to my test:
IoC.Register<IRunAtStartup, NonWebRunAtStartup>();
This led me to another error, which I'm still struggling with, and I will ask it as a separate question (now the NSB cannot load assemblies that are in the NServiceBus.Core.dll file, for example Antlr3.Runtime DLL).
source share