I'm testing a trivial web role under Azure Compute Emulator and have overridden OnStart()
, Run()
and OnStop()
methods in my class that derives from RoleEntryPoint
.
OnStart()
and Run()
are called but OnStop()
is not - I will either press "Stop debugging" in Visual Studio or close the browser window and the role will be terminated, but OnStop()
is never called. I've checked - the override
keyword is present in OnStop()
definition.
That's not very convenient - it means I can't test my OnStop()
outside a live cloud.
Can I somehow make Compute Emulator call OnStop()
in my role?
I suspect (but I'm not sure), that if you open the compute emulator UI and "stop" the deployment there, OnStop() should be called.
You can use csrun to update the configuration of a running deployment. When you give the command the instance will call the OnStop() method.
To update the ServiceConfigure:
In my Compute Emulator it would be:
If you intentionally exit from the Run() method, I believe OnStop() should be called.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With