-->

IIS 7 Restarts Automatically

2019-07-24 12:04发布

问题:

I have a WCF Service Deployed on IIS. (BasicHTTPBinding with [AspNetCompatibilityRequirements(RequirementsMode = AspNetCompatibilityRequirementsMode.Allowed)])

I have built custom in-memory session management and Now I am facing a strange problem that is IIS 7 Restarts Automatically without even throwing any kind of warning or error not even in EventLog. This problem leads to destroy the all available sessions.

I discovered this issue after logging the Application_Start and Application_End methods using log for net and also i put the break point in application_start and it paused there in between test execution.

This happens rarely but i need to know why it happens and if it is normal and acceptable or not. if not then what may be the possible reasons of this.

Regards Mubashar Ahmad

回答1:

IIS recycles worker processes either when it detects an "unhealthy" process, or after certain operator-configurable limits are reached.

Among the limits are:

  • memory threshold
  • after a configured number of requests
  • elapsed time
  • time of day

more info



回答2:

Could it be the app pool being re-cycled? IIS 6 has this set on by default to 1740 minutes. As for IIS 7 I guess you would have the same kind of setting? I know in IIS 6 this "event" is not logged as 'n error.



回答3:

The Session timeout (which is separate to the app pool recycling) is set to 90 minutes by default, this is set at the application level. This also means anything being held in Session will be blown away at that time. You can set it via the properties of the virtual directory/application in IIS6, and via SessionState->Open Feature in IIS7 (when you have the application selected).

Also note that session timeout can be set via the web.config of an ASP.Net application, should your web services be hosted in one of those.