I use asp.net and set the session timeout using
Session.Timeout = 1440;
but the session timed out, is there anything shall I fix or adjust in iis 7 and 6
Best regards
This may work
<configuration>
<sessionstate
mode="inproc"
cookieless="false"
timeout="1440"
/>
</configuration>
If the sessionstate timeout in the web config is not working check for memory leaks in your application. I had the same problem in a legacy application I inherited. After a lot if digging I found some custom server controls with static variables and static objects referenced by multiple pages and other objects. This caused the application to never release resources. Eventually IIS recycles the pool when it runs out of memory. When the pool is recycled all sessions will be unloaded from memory also.
Related
Senario: I have multiple .aspx page coded with Get session timeout, and the .aspx are stored in SPS .../_layouts/15/MyPages/ folder. Below is my changes on web.config
web.config
<pages enableSessionState="true" ... >
...
<add name="Session" type="System.Web.SessionState.SessionStateModule" preCondition="" />
.aspx C# code
int milliSec = (this.Session.Timeout * 60000);
Will this affect other application in SharePoint? If yes, can my .aspx page have it's own web.config to prevent conflict?
Changes of web.config will affect only corresponding web application. But increasing timeout is generally not a good idea especially when you want to affect only one your page. Much better solution is using SPLongOperation object to implement your logic. There are at least three reasons:
It is systematic solution that solves not only timeout but also waiting animation and standard behavior.
Setting timeout in web.config affects whole web application not only your page.
Any value you put in web.config could be too low for slow systems and too high for fast systems.
I want to set timeout for my web application for 12 hours.
I have done setting in web.config file as:
<system.web>
<sessionState timeout="720" />
</system.web>
As suggested in the following post:
I came to know that the Application Pool recycles in every 20 minutes (if the pool is ideal).
And I also checked for changing the application pool time out using one question about application pool timeout setting
But still the session time-out is not set to 720 minutes. Do I need to change machine.config file for changing the session time out.
But I think the properties of machine.config file should be overriden by web.config file.
Kindly provide me some idea.
You can try out WMI(Windows Management Instrumentation) script it can help you.You need to have sufficient priveleges to implement the Script.
follwing are the links you can check to get more information.
http://bendera.blogspot.in/2010/12/configuring-ica-rdp-timeout-values.html
http://technet.microsoft.com/en-us/library/cc771956%28v=ws.10%29.aspx
You should set all following:
Application Pool / Advanced Settings. There the option Idle Timeout should be set in minutes.
Then within the web.config file in system.web section you should also set the Authentication/Forms, SessionState and RoleManager timeouts, if applicable.
<authentication mode="Forms"><forms loginUrl="~/default.aspx" name=".ASPXFORMSAUTH" timeout="120" /></authentication>
<sessionState cookieless="AutoDetect" cookieName="TYS_ADMIN_SessionId" timeout="120" />
<roleManager ... cookieTimeout="120" defaultProvider="GMRoleProvider" enabled="true">...</roleManager>
The most irritating problem i've come across. I have an asp.net mvc application with sessionstate mode to stateserver. On my local machine and my old server iis6 it worked but i recently changed to a new server running iis7 and now the line:
<sessionState mode="StateServer" stateConnectionString="tcpip=127.0.0.1:42424" timeout="20" />
doesn't do anything. Even when I set the value in the connectionstring to something that doesn't exist it is ignored and thus it's using inproc only.
All my webapps under iis have the same problem.
I've also tried sqlserver mode with the same result. it just gets ignored.
Why oh why??
There's a place in IIS where you can disable InProcess session state.
These articles should point you in the right direction:
http://technet.microsoft.com/en-us/library/cc732964%28WS.10%29.aspx
http://technet.microsoft.com/en-us/library/cc725624%28WS.10%29.aspx
I use ASP.NET website on IIS7 where in web.config I have:
<sessionState mode="InProc" timeout="20"></sessionState>
But session doesn't keep 20 minutes, it works very strange, sometimes it expires in 1 minute or less, sometimes just redirect to other page. I need use mode="InProc".
Who can help me, what is wrong and how to resolve this problem?
Thanks!
If you have an application that is throwing unhandled exceptions, the application could recycle. Or, it could recycle because of memory pressure or even just from the wrong settings in IIS. This would cause you to lose session. You can put some logging code in the Application_End Eventhandler in global.asax to check for this condition.
Application Pool Recycling? (IIS setting).
Anyway, you can detect and handle the timeout in the global.asax (session_end), if that helps.
I am experiencing a request timeout from IIS when I run a long operation. Behind the scene my ASP.NET application is processing data, but the number of records being processed is large, and thus the operation is taking a long time.
However, I think IIS times out the session. Is this a problem with IIS or ASP.NET session?
If you want to extend the amount of time permitted for an ASP.NET script to execute then increase the Server.ScriptTimeout value. The default is 90 seconds for .NET 1.x and 110 seconds for .NET 2.0 and later.
For example:
// Increase script timeout for current page to five minutes
Server.ScriptTimeout = 300;
This value can also be configured in your web.config file in the httpRuntime configuration element:
<!-- Increase script timeout to five minutes -->
<httpRuntime executionTimeout="300"
... other configuration attributes ...
/>
Please note according to the MSDN documentation:
"This time-out applies only if the debug attribute in the compilation
element is False. Therefore, if the debug attribute is True, you do
not have to set this attribute to a large value in order to avoid
application shutdown while you are debugging."
If you've already done this but are finding that your session is expiring then increase the
ASP.NET HttpSessionState.Timeout value:
For example:
// Increase session timeout to thirty minutes
Session.Timeout = 30;
This value can also be configured in your web.config file in the sessionState configuration element:
<configuration>
<system.web>
<sessionState
mode="InProc"
cookieless="true"
timeout="30" />
</system.web>
</configuration>
If your script is taking several minutes to execute and there are many concurrent users then consider changing the page to an Asynchronous Page. This will increase the scalability of your application.
The other alternative, if you have administrator access to the server, is to consider this long running operation as a candidate for implementing as a scheduled task or a windows service.
Great and exhaustive answerby #Kev!
Since I did long processing only in one admin page in a WebForms application I used the code option. But to allow a temporary quick fix on production I used the config version in a <location> tag in web.config. This way my admin/processing page got enough time, while pages for end users and such kept their old time out behaviour.
Below I gave the config for you Googlers needing the same quick fix. You should ofcourse use other values than my '4 hour' example, but DO note that the session timeOut is in minutes, while the request executionTimeout is in seconds!
And - since it's 2015 already - for a NON- quickfix you should use .Net 4.5's async/await now if at all possible, instead of the .NET 2.0's ASYNC page that was state of the art when KEV answered in 2010 :).
<configuration>
...
<compilation debug="false" ...>
... other stuff ..
<location path="~/Admin/SomePage.aspx">
<system.web>
<sessionState timeout="240" />
<httpRuntime executionTimeout="14400" />
</system.web>
</location>
...
</configuration>
I'm posting this here, because I've spent like 3 and 4 hours on it, and I've only found answers like those one above, that say do add the executionTime, but it doesn't solve the problem in the case that you're using ASP .NET Core. For it, this would work:
At web.config file, add the requestTimeout attribute at aspNetCore node.
<system.webServer>
<aspNetCore requestTimeout="00:10:00" ... (other configs goes here) />
</system.webServer>
In this example, I'm setting the value for 10 minutes.
Reference: https://learn.microsoft.com/en-us/aspnet/core/hosting/aspnet-core-module#configuring-the-asp-net-core-module
Remove ~ character in location
so
path="~/Admin/SomePage.aspx"
becomes
path="Admin/SomePage.aspx"