Monday, February 26, 2007

.net session timeout settings in IIS6 on windows 2003 server

Does this sound simple web.config setup?
Nope this is way beyond that newbie configuration.

Problem: We were facing timeout issue on one of our servers. Web.config settings had no effect on the time out.

Note: In all screen shots pink color is hiding the actual server details.

So here are some more interesting findings related to timeouts of sessions in IIS6 hosted on a windows 2003 server. You may need to change one or more of these setups in your server according to your setup.
There are totally 5 setups that influence your timeout. All of those are discussed here.
1. Web.config file of Application: First one to influence timeout is Session timeout setting in your we.config file.

Note: Web.config file is inherited to the subfolders and subfolders config settings take the precedence in case they exist.

2. Application session timeout in IIS:
Go to IIS, right click on the web application, go to properties. Go to Directory tab, click on Configuration button. Application configuration tab opens, click on Options tab as in the screenshot, you will find enable session state. Change the session time out period here.

3. Default website session timeout in IIS: Right click default web site under IIS and choose Home directory tab. Click on configuration button to open application configuration. Choose options tab and you will find Enable session state again similar to session state of each application. Enter higher session timeout period which will be application to all sites in the webserver.

4. Change Worker process idle timeout of application pool – Shutdown worker process after being idle for (time in minutes) – Default is 20 minutes. This setup is applied for all websites that use this application pool. To change this, Right click on the required application pool, choose Performance tab, and change the duration of idle time or uncheck the option so that the process is never recycled. You can also create an application pool, configure it, and use it for a selected list of web applications.

5. Change Recycle timeout period of application pool: Right click on application pool or default application, and choose Recycling tab. Change the “Recycle worker process (in minutes)” option to either change the period or disable the option by un checking. Un checking this option may be a good idea from performance point of view.

And finally there is a last one in machine.config file. But that does not affect any of these configurations and these setups take the precedence.

Let me know if you have any timeout related issues. Lets share.