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.
Solution:
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.
57 comments:
This information has been very helpful to me. I had all the settings set in web.config but it didn't have any effect on session timeout. After changing the settings in IIS as mentioned in the article... The application runs without any glitches...
Thanks a lot...
:) I am glad it helped you.
Hi Sanjay,
I came across your article regarding IIS settings and was wondering if you had any recommendations on a site that uses sessions extensively rather than cookies. You state that application pool setting should be modified but don't include any values. My question is what is the balance of time vs memory consumption. I have 4 gigs of memory on my server and need your rec on the values that I need to change in the application pool.
Any insight would be appreciated.
Hi Shane,
Sessions should be used sparingly as they take up lot of resources and till session expires. If they are already used extensively, consider reducing the session timeout period specially if you have lot of visitors to the site. Also note that reducing the timeout to a smaller value frustrates the users.
Before increasing or decreasing the timeout values, i would suggest you to first study the user base, time taken for processing the request and the response time of the server. Ideally session should time out from 15-20 minutes.
In the example that i have shown on my blog, we just wanted to increase it to 90 minutes and various IIS settings were not letting us achieve the same as documented.
Dear Sanjay,
I really like you explaination, no other document on the net can beat it.
However, I did follow everything that you mentioned. I set the timeout as 90 minutes on IIS.
I've set the timeout to 120 minutes in the web.config.
But the session timeouts are sooo random. I've been on this for 4 days now, can't figure the problem.
Is there anything that I should be looking.
Thanks in advance
Sri
We had "InProc" session management and the sessions would drop very randomly.
Background
We had a process which was logging the time and date the daemon process was run. See the below link, of what it has to say!
http://support.microsoft.com/kb/324772
Cause
if any file in the application's directory changes, the session would be lost!
Strange but true, MSFT calls it a feature, but honestly I think this is a flaw in the “InProc” session management of MSFT IIS 6 Server.
Solutions.
1.Change the session management algorithm
2.Don’t update or create any files in the application server directory
Any questions please feel free to email me sridhar@ligaturesoftware.com
http://www.ligaturesoftware.com
Hopefully, this will help
:) Being in to software industry is all about learning and fixing new kind of issues..
Wonderful wonderful
It helps me lot
many many thanks
PRIVILEGED AND CONFIDENTIAL
Prepared at the Request of Counsel
Thank you very much for your artticle, ".net session timeout settings in IIS6 on windows 2003 server."
Configuring our server using your instructions solved our problem where, no matter what web.config settings were for the session timeout property, we still would experience session time outs after 20 minutes.
I only wish Microsoft's knowledgebase was as clear and complete on this issue. I must have read through about 50 pages before finally finding yours, and I immediately knew that your instructions were going fix the problem Again, thank you so much, and I am bookmarking your blog for future reading!
Andrew Wiley
Project Manager
******** Team
Office # ***-***-****
Cell # ***-***-***
Hi,
It’s really a nice article. Thanks for sharing information. I have one question is there a way to handle session timeout value in application code, I am considering hosting on public server were we don’t have access to IIS or application pool. And changing a value in the Web.config is not helping out. Is there a way to manage timeout.
Thanks in advance.
Cek Web Garden settings in Application Pool, if the value of Max number workers greater than 1 (1 is default value). You better use SessionState as Session Storage management, do not use InProc session since your session will lost randomly
If you do not have access to webserver's configuration, you have very few options left out with you. This is specially true if you are on publicly hosted server. You can only control session timeout less than whats defined on the server. Lets say your server configuration is set to 30 mins all you can do is set it less than that. If you set anything beyod 30 mins, server will anyway kill the sessiion.
Great article.....very detailed and resolved the problem 110%, very well done.
hello
how to redirect to a custom page on session time out?
So what is the order of precedence?
If the web.config timeout is 90mins and Default Website session in IIS has 30 min, and the Application IIS setting is 15 min - what happens? (Running only asp.net (.aspx pages))
Hi Sanjay,
I found your paper quite useful, but I still have an issue with the app.configuration session state, the second you stated in your article, i need to change the default value by code, while i am installing the site. i´ve already changed the authorization values with a custom action and i would like to add code to modify the app.configuration session state. could you help me out please. thanks in advance. ggoonn
Absolutely great post. Thanks for sharing it in an organised way.
Arun
really nice article about session timeout in page.thanks for your help.
By Pachayappan.c
Folks,
I figured it out! I will post it here for others
1. Very important, we should not changed the timestamp of ANY file in the bin directory. Eg: We were creating the log file in the bin folder and that was killing the session.
2. The worker process as explained by Sanjay helped. We should not enable the Worker process unless we feel the application is having memory leaks or runs in infinite loop in general if we feel that the app is problematic.
thanks
SRI
Folks,
I figured it out! I will post it here for others
1. Very important, we should not changed the timestamp of ANY file in the bin directory. Eg: We were creating the log file in the bin folder and that was killing the session.
2. The worker process as explained by Sanjay helped. We should not enable the Worker process unless we feel the application is having memory leaks or runs in infinite loop in general if we feel that the app is problematic.
Thanks
SRI
thanx Sanjay :) that was very helpful
Have u encountered a similar problem like this:
We have an IIS6 server which accesses a websphere server using a websphere plugin.
If the application is accessed thru the IIS6 server, everytime the page submits, the session is lost and a new session is created.
However, it works fine when accessing the app thru the websphere server directly (Sessions are not lost).
Any idea on how to resolve this? Any help would be greatly appreciated.
Hi Sanjay,
My application is in .NET framework 2.0. we wanted to change the forms authentication timeout from 30 minutes to one hour. We made the changes in the web.config but it didnt help. It is getting timedout and going back to the login page after 30 min. We tried to make it less than 30 min. It worked then. Is there any maximum limit for the timeout in .NET 2.0? Please reply.
I am facing problem of session time out. I want to maintain session upto 6 hours and i did settings in web config file and IIS but its not working. Its working in on local server but not working on Production ( webserver). Actually we have two webserver for running web application. Can it create problem ?
Hi Sanjay,
May God bless you! Thank you so much for this great post!!
I had the same random timeout problem on iis6 and win2003. We have several sites hosted on the same iis server. The problem didn't go off until i removed the worker process shutdown checkbox in the Main pools properties.
Keep up the good work!!!
Regards,
Jack
Hi Sanjay,
Your document is really helpful. but we've tried all these steps in our server. but still we are facing time out problem. Is there any other chance to override session timing(thro' code)? please advise.
Thanks,
Santhiya
Really gud article Sanjay
Thanks a lot. I hav never think about the session timeout problem could com from IIS.
It helped me as well. I was wondering about it, i was using custom code to set the set the session timeout in asp and it was not listing it for some reason then I had to look into the server setting with this article's help. It is good to go now. Thanks..
If you experience random timeouts for your sessions (ie timeout quicker than specified in sessionstate and idle timeouts), you may want to check if your application pool in IIS 6.0 has any 'Memory recycling' values selected and they are set up to some low sizes both for virtual or used memory.
If e.g you have 200 Mb and the application reaches that limit in 5 minutes (e.g) the recycle happens and any sessions are killed sooner than expected...
Thanks a lot.
The article is really fruitful.It helps me to solve the problem.The good point is that everything is available in one article.
Hi Sanjay,
It is really Excellent and helpful.
Thank you so much....
i often get a error like "unhandled win32 exception occured in svchost.exe..do u want to debug using the selected debugger?".
If i give no the application/explorer will get closed.can u tell why this is happening?
i was searching this solution for a whole day and finally i got it..thanks a lot.
Hi,
This blog was quite helpful, but I am facing 1 more problem. When I paste any file in the root folder or any of the subfolder of my web application, all the sessions on the web server gets flushed out immediately.
-- Anuj D.Vaijapurkar
.Net Developer
Nice post addressing session timeout issues
http://blog.bodurov.com/Session-Recovery
Fantastic article, thank you. This solved a days-old problem I was struggling with.
You might revise the original to include SRI's information about changing files in the bin directory; I see there is still a lot of confusion on this.
Thanks for your article, Sanjay.
I would like to share the problem I had, which is related to your point #1 - I confused the "sessionState" section with the "authentication/forms" section of the web.config - they both have a timeout value. I couldn't get my session timeout to go above 20 minutes, then I realized that I didn't have the "sessionState" section in my web.config - I had been changing the "authentication/forms" timeout value.
I am working on this issue "timeout issue on one of our servers",for long time ,At last ,find the solution from your blog ,thanks for your exlanation.It gave me a good help .I shared it with more and more people in my folder ,my-dig.
HOPE those who need it could find it.
Thanks is have been like 3 month of research and looking what was wrong and finally working. I change the web option and in application I use plesk control panel so I change the option for plesk and now is all working Thanks.
Hi Sanjay,
Thanks for such a wonderful info. I am facing same problem i.e. random timeout and i have also checked all the options. Everwhere it is set to 20 minutes but currently we are facing random timeouts may be within 5-10 mins. What would be the reason?
I am using ASP.NET 2.0, IIS6 and SQL Servwer 2005 for storing session state.
Please help.
HI Sanjay...what a great post!!! after 2 hours of research and contradictory statements from various websites, i bumped across this one and it resolved our problem in minutes!!! thanks again, Pete
Hi, having read your post I just wanted to point out that the IIS settings for Session Timeout are related to ASP and not ASP.NET.
I am glad that this blog was useful to you guys.
What are other side effects if we put 90 mins in Enable Session state,recycle work process etc.
Appreciate any help.
Thank you.
This Blog is very nice and useful.
We have one problem in my site. We have not set any session timeout constraint in my site.(Not in Web.config file or any where)
We have just set session timeout in IIS worker process is 55 min.
Now, we are gating server timeout problem sometimes. Its not every time that we are gating this problem.
Can you please gives us your views regarding this?
Thanks Sanjay
Hi Sanjay,
My web application runs under web-farms and application-pools also used. On production servers session time out works shortly than local machine and test server. All configurations seems identical, the only difference is of web-farm is used on production-servers. What could be the problem? i have checked the application pools too. Please help.
Your blog is very useful.My application is working on local server.its settings are
web.config - 600
application session timeout in iis -700
default website session timeout in iis -700
worker process idle timeout out of application pool-800
recycle timeout period f application pool -1740
Is anything wrong with this settings?
i am getting log out problem twice or thrice in a week.what could be the problem?Thanks in advance.
Thanks, this is very helpful.
Track Back - http://mitchdavis-work.blogspot.com/2011/09/session-and-iis-60.html
Thanks.
I have Classic ASP Website hosted on IIS6 (Windows Server 2008 Standard) and facing same session time out issue.
I have Classic ASP Website hosted on IIS6 (Windows Server 2008 Standard) and facing same session time out issue.
Hi sanjay,
Thanks for useful information.
I have facing problem bellow now.
session state working locally but not work some time on iis 6 web server.
Sorry guys its been some time that i stopped development on this platform hence not been answering questions.
Dear Sanjay, I am facing a issues with my IIS 6 hosted in Win 2k3 R2 that 'Connection time out error' where IIS stops working.
After 2-4 0r 8 min automatically it works fine.
It is a repeated issues i am facing since many days.
Post a Comment