Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is it possible to disable ASP.NET website sleep in IIS?

Tags:

asp.net

iis

I run my website in IIS and I've got some running timers with events there. (I know that it's bad design and plan to recode it however for now I want to check if there fast solution)

After some time website is going to sleep and that's why my timers events do nothing.

Is there IIS setting or another way to reject sleeping?

like image 989
cnd Avatar asked Apr 23 '14 05:04

cnd


People also ask

What is IIS idle timeout?

The idle timeout determines the number of minutes the application pool (and thus the application Enterprise Tester) will be held in memory, with any requests being made, before the application is automatically unloaded from memory. On most default IIS installations, this value will default to 20 minutes.

How does ASP Net work with IIS?

IIS works with ASP.NET Core A request comes in to the IIS server from the web, which sends the request to the ASP.NET Core application, which processes the request and sends its response back to the IIS server and the client who originated the request.

What causes IIS to stop responding?

IIS hangs happen when all available IIS threads are blocked, causing IIS to stop dequeueing additional requests.


1 Answers

Well this might be usefull to you as detailed here :-

http://forums.asp.net/t/1950241.aspx?ASP+NET+MVC+website+goes+to+sleep+How+to+nake+it+always+awake+

There are quite a few ways to set timeouts within .NET (Session Timeouts, Forms Authentication Timeouts and IIS-related Timeouts). Your issue most likely relates to the IIS Idle Timeout as mentioned below :

Setting the Application IdleTimeout property within IIS :-

You may need to check what your timeout is configured for within IIS, as this timeout will override the timeouts defined in your web.config.

Within IIS there is a setting called Idle Timeout, which defaults at 20 minutes. This could explain your early timeout issue.

Configuring the IdleTimeout property within IIS

Scott Hanselman also addresses strange issues that can occur when dealing with timeouts when using Forms Authentication in this blog post as well.

Some other commonly encountered timeouts might be through the Session or Forms Authentication, which would be adjusted as seen below.

Setting the SessionState Timeout within your web.config :-

You can update the timeout property of your Session State (if that is what is actually timing out) within your web.config file in the element as shown below (default of 20 minutes shown below):

<configuration> 
 <system.web> 
 <!-- Adjust the timeout property below -->
 <sessionState mode="InProc" timeout="20"></sessionState> 
 </system.web> 
</configuration>

Setting the Forms Authentication Timeout within your web.config :-

You can adjust the specific timeout property of your Forms Authentication in your application by adjusting the timeout property within the element of your web.config file. You will also want to be mindful that if you are using the slidingExpiration property in conjunction with timeouts as they can actually expire much earlier than the timeout listed.

<authentication mode="Forms"> 
 <forms name=".ASPXAUTH" loginUrl="~/Login.aspx" timeout="yourTimeoutInMinutes"></forms> 
</authentication>

So if you wanted to extend the amount that the authentication token stays "alive" for to say 360 minutes (6 hours), you would set it as seen below :

<authentication mode="Forms"> 
 <forms name=".ASPXAUTH" loginUrl="~/Login.aspx" timeout="360"></forms> 
</authentication>
like image 142
Neel Avatar answered Sep 20 '22 20:09

Neel