Prevent worker role recycle

206 Views Asked by At

I have an Azure Worker role that downloads images and rescales them. If the worker role is really busy my solution recycles quite often. I think it is IIS restarting the role because of the high CPU or high error exception rate (the download can receive a 404 exception which is handled by the way).

  1. How can I find out what the cause of recycling is? I added a the following code but does not give me a lot of information:
public void Application_End(object sender, EventArgs e) 
{
    // Find out why the application ends
    var reason = HostingEnvironment.ShutdownReason;
    LogException("Application.End", "Hosted Service: " + CwPlatform.HostedServiceName
        + ", ShutdownReason:" + Enum.GetName(typeof(ApplicationShutdownReason), reason), 
        ExceptionLevel.Critical);
}
  1. Is there a way of preventing IIS to recycle because of this?
0

There are 0 best solutions below