views:

310

answers:

3

Dear Gurus

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

+4  A: 

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.

Rihan Meij
That is probably the reason. Here you can see how to configure recyclation: http://www.iis.net/ConfigReference/system.applicationHost/applicationPools/add/recycling
Jan Remunda
Thanks for Quick Reply. This thing is new for me, but after reading detailed log i noticed that its becoming a bit often now may be i should log on application_error as well. Ok, Apart of Recycling is there any other reason recorded for this????.
Mubashar Ahmad
What is your memory doing? A re-cycle may also be triggered by a memory limit being reached. The option for this is also set on the application pool level, as far as I know
Rihan Meij
I normally use http://live.sysinternals.com/procexp.exe (Process explorer from Sysinternals) to monitor memory, threads and IIS in general if it is doing funny stuff.
Rihan Meij
hmmm that may be the cause as i am on 2 GB ram only and using sql server as a backend and I am performing more than 12 queries in a second over 10 database connections. Let me try it on my Server Machine with 8GB RAM. i ll let you know thanks for another hint.
Mubashar Ahmad
IIS is a interesting animal, equal parts science and art. In my humble opinion. Try using something like process explorer as well to see what your memory does over a while, it might be that you have a memory leak? That can then push the app pool over the predifined memory usage limit, triggering a reset.
Rihan Meij
Really Sorry Rihan but i am trying to search w3wp.exe in Process explorer from Sysinternals as you recommended. sorry for being dump in this case :S:S. I am using iis 7.5.* and Application Pool and app name is RpmDSS. Pls help me again :S
Mubashar Ahmad
A: 

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.

slugster
Dear Slugster as i mentioned before I am using custom sessions and also stated that I am receiving log from Application_Start and Application_End then how could it be due to the session timeouts. Thanks anyways
Mubashar Ahmad
+1  A: 

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

Cheeso
Are you talking about Application pool recycling as i am using IIS 7 comes with Win7 i think its IIS 7.5.* build. If yes then i have checked out the recycling configuration its set to only after a scheduled duration that is set to default(1700+ mins). Even if there there are some sort of error then why its not logging it somewhere :(:(
Mubashar Ahmad
I agree with you, in terms that it is a error when that occurs, I suppose it is something we can debate at length. I think the primary reason for this kind of behavior by default is to make the perceived reliability of IIS bigger, by being more fault tolerant.
Rihan Meij
it's easy to see if you are getting process recycling. just check the process ID. You can even embed it into the WCF response, as a diagnostic step. (System.Diagnostics.Process class)
Cheeso