My Azure web role currently contains lots of bugs and throws exceptions from OnStart(). Once an exception is thrown Azure runtime starts the role again. That’s not convenient for me – the role OnStart() runs to exactly the same point and crashes again and this continues forever. I’d rather have it stopped once it crashes.
Can I somehow ask Azure runtime to not restart my role once OnStart() crashes with an exception?
It seems a bit heavy handed, but you could try using the management API and stop the whole role in the try catch.
Personally I think it’s much easier to just use
Thread.Sleep(Timeout.Infinite)as smarx suggests