Onstart is probably a bit to early in the lifecycle of nservicebus to get hold of the bus.
Implement a class with the interface IWantToRunWhenTheBusStartsAndStops and you should have access to the fully initialized IBus instance there...
Pregunta
I have a problem. I setup azure worker role which use NServiceBus with Azure Service Bus:
public class Host : NServiceBus.Hosting.Azure.RoleEntryPoint
{
public override bool OnStart()
{
RegisterByObjectFactory.Register();
ServicePointManager.DefaultConnectionLimit = 12;
return base.OnStart();
}
...
In my worker role I use services which have parameters IBus.
Spent 3 days to figure out how to do it but still without success.
If I try to inject the NserviceBus in the RegisterByObjectFactory then on row "return base.OnStart();" I receive the error that the ConnectionString property was locked :(
Please help.
Solución
Onstart is probably a bit to early in the lifecycle of nservicebus to get hold of the bus.
Implement a class with the interface IWantToRunWhenTheBusStartsAndStops and you should have access to the fully initialized IBus instance there...