IIS Settings application pool idle timeout causes WPF not responding - asp.net

I have a Window Presentation Framework application that uses web services to load data in user interface. I notice that when i leave my application idle for 10 min and access my application again, my application is not responding for 3-10 sec. After some research i choose to set my application pool idle timeout in Internet Information Services to 0 and my problem solved. I have some understanding that after i leave my application idle for 10 min, my OS will free up the memory resource that allocate to my web services processes but i still have some doubt on this.
My question is
1) The default idle timeout is set to 20 min, why the OS terminate my process after i left my application idle for 10 minute only?
2) During the first time when i log in to my system, why there is no "not responding" issues given that the application just started to call the web service? I assume the application will need to call the web service again after i idle for 10 min and the OS terminate my process but this time my application become not responding..

Related

What timeouts govern worker process shutdown when stopping an application pool

I have an ASP.NET (.NET Framework) site running in IIS. The site has a long-running background process and when the application pool is stopped as part of tearning down an active VM I'd like for the w3wp process to continue running until the background process shuts down gracefully (which can take a long time).
We leverage a custom IRegisteredObject to plug into ASP.NET shutdown; our code does not return from the Stop(true) call until the background process shuts down.
When we stop the application pool, we see in our logs that Stop(false) is called and then Stop(true) is called 30s later like we expect. However, before Stop(true) returns IIS is simply killing the worker process. This kill happens five minutes after the initial Stop(false) call. We'd like to extend this timeout.
In IIS itself, we have App pool->Process Model->Shutdown Time Limit to 1000s. Lowering this value below 5 min can make the kill happen sooner, but raising it above 5 min does not prevent the kill at 5 min.
Is there some other timeout setting that governs this shutdown? Is it possible to go beyond 5 minutes?
The shutdown time limit hint leaves the old worker process running for up to the number of seconds indicated. If all requests are completed prior to that time, then it will shut down earlier. this is why you lower the value below 5 minutes to make the killing happen sooner.
And the maximum shutdown timelimit seconds appears to be 4294967, this is more than 5 minutes, But if there is not enough free memory, it will cause no more than 5 minutes.

iis process serving application pool exceeded time limits during shut down

Recently, some of my IIS application is having no response. I check the event log and found that some
error happened in WAS service which cause some application pool to be stopped.
The following is the error message.
I can see only the process id causing
the problem.
I checked the error and find in one apppool a process is exceeded time limits during shut down.
Is that possible the process cannot shutdown and cause the other apppool to shutdown. My solutions is set the Test_pool application pool timeout to 1440 minutes(24 hour) and set recylcing time at a specific time
of the day to avoid the shutdown failure of process and prevent the auto shutdown of application pool. Is that workable?
A process serving application pool 'CEHL_POOL' exceeded time limits during shut down. The process id was '529004'.
A worker process '504596' serving application pool 'TEST_POOL' failed to stop a listener channel for protocol 'http' in the allotted time. The data field contains the error number.
A worker process with process id of '794136' serving application pool 'TEST_POOL' was shutdown due to inactivity. Application Pool timeout configuration was set to 20 minutes. A new worker process will be started when needed.
Application pool 'TEST_POOL' is being automatically disabled due to a series of failures in the process(es) serving that application pool.
Application pool 'DefaultAppPool' is being automatically disabled due to a series of failures in the process(es) serving that application pool.
The event logs included mutiple errors with different application pool. So please point out which application pool stop responding. The error message "exceeded time limits during shut down" means the application failed to finish all current requests inside the process before application pool shutdown timeout reached. So either threads hang up or locked up.
“being automatically disabled due to a series of failures。。。”is caused by rapid failure protection, so you need to check application events and you should be able to find the crash event.
No matter crash or hang, you need to reproduce the issue and monitor the request status inside worker process monitor. It will show the time taken and current handler. You may need to collect and analyze dump file to trace the root cause.
Besides, in some case, http.sys will cause this issue because it is no longer able to wake up a new appliction pool. You may need to check whether your application pool is able to be waked up after your application stop responding.

Can IIS AppPool be unavailable due to idle?

I have a ASP.NET application running on IIS 8. My application sometimes does not respond to request with clients logging a timeout and then IIS starts sending out 503 Unavailable response codes. Each outage seems to last 5 minutes which corresponds to a 5 minute limit interval for Kill w3wp.
I have the App Pool configured for a Kill w3wp limit action with limit percentage of 80%.
While it might seems the pool is getting killed due to high CPU usage, I could not find any records in the event viewer. In fact, it had gone to idle state because of no requests in about 25 minutes.
The crash happened with 3 simple identical requests issued when the pool was idle.It cannot be reproduced manually in any environment.
This is happening about once a week. Since its a critical application, its running on a separate server with no other applications installed.
I have changed the Limit from Kill to throttle but I am not sure its a good idea. Anyways I've got to find a way to reproduce this.
Can the pool fail to exit an idle state?
If there is no traffic, w3wp.exe may go idle aka stop running. But that is not the same as it being truly stopped and it would not cause a 503. It would just start back up on the next request.
A 503 is more likely because your IIS App Pool is crashing or literally being stopped.
I would check Windows Event Viewer to see if says anything around that time frame around w3wp crashing. You can also set IIS to do more detailed logging anytime your w3wp app pool is stopped, started, recycled.
Docs about enabling more app pool logging:
https://technet.microsoft.com/en-us/library/cc753412%28v=ws.10%29.aspx?f=255&MSPPError=-2147217396
You could also search various IIS logs for errors:
https://stackify.com/beyond-iis-logs-find-failed-iis-asp-net-requests/
If you set auto recycle option then remove it and make it schedule recycle instead.
It seems as the memory consumption by your application tends to saturation level, IIS being recycled

web app slow performance when leave idle for some time

We have a web application deployed on IIS 7.5 target framework 4.0
the application perform slow when leave idle for few minutes for first time and then perform as expected this happened each time application is idle.
With the help of fiddler I found its TCP/IP connection which is taking time about 21 secs whilein subsequent calls this time is 0.
The Idle time out is also set high and connection time out is also high in the IIS settings.
server is - Windows 2008 R2.
there is nothing in the event viewer related to the website.
we used form authentication but the time out for that is also set about 10 hours in the config file.
Can anybody point me to the setting with is affecting the response time after the app is idle for some time.
Note - this was working proper when deployed withing the LAN but this problem starts when deployed out of the LAN or in separate domain.
Problem
here is the problem in IIS app pool idle time out, its by default set to 20 minutes, after 20 minutes app pool shutdown if no request within 20 minutes,
when any request comes after 20 minute its again start,
The problem is that the first visit to an app pool needs to create a new w3wp.exe worker process which is slow because the app pool needs to be created, ASP.NET or another framework needs to be loaded, and then your application needs to be loaded. so it may take time 20-30 seconds or depends on the application content size.
Solution
so to avoid this type of delay we need to set the idle time out to 0.
now it will always load fast.
app pool setting
The IIS application pool is shut down after 30 minutes of inactivity. After that, when you make a request IIS basically has to start the website up again, which leads to the behavior you are describing. You can change the idle time of your website in IIS though to avoid it.
You could also look into the Auto-Start feature of the 4.0 framework.
Well, a bit late, but may help someone else. I had the same problem, nothing in the logs, spent days, then looking at the network adapter properties / configuration / power management - Allow computer to shut down save power was checked. Unchecked and the problem was solved.

IIS 7 Application Pool work process life and Session life

In IIS7 Application Pool there is a setting Idle-time out default is 20 min,
which says:
Amount of time(in minutes) a worker process will remain idle before it shuts down, A worker process is idle if it is not processing requests and no new requests are received.
My question is, if the worker process shut down because of the time-out time, does the session created by application which is hosted in this worker process get lost?
Yes -- the session data is tied to the app pool worker process, so once the worker gets shut down, the session data is lost.
The default behavior is to store session variables in the memory space of the ASP.NET worker process.
(Of course, this assumes you're using InProc as the session mode. If you're using the database, then it will persist after the worker gets shut down.)

Resources