Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
295 views
in Technique[技术] by (71.8m points)

c# - Prevent worker role recycle

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?

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)
等待大神答复

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...