asp.netiisiis-8windows-server-2012-r2worker-process

Specific application in IIS taking is slow after worker process stops after ideal timeout. long time to serve


One of my applications in IIS takes too long to serve requests after the worker process stops after its ideal timeout. It is an API that is used for various calls like login, fetching data etc. So when I restart the server everything works fine but once the worker process stops after ideal timeout, only this login is taking too long to serve the request, rest all fetching data and other services are working fine.

I know that for first request it will take some time because worker process has to start. This is happening for every application but it is only for 1st request. However, for login request for every request it is taking long time.

IIS restart also won't work. I have to restart entire server then it will work fine until the worker process stops.

Everything is setup using ASP.NET in IIS 8.5 on Windows server 2012 r2. Database is on a separate server.

Edit: I observed that while restarting server if I keep on making requests from app, there is no issue. But if I make request after sometime the server restarts then I'm getting this issue.

Maybe if worker process starts before some sort of service/application (which takes sometime after server restart) then there is no issue but if I don't make any request immediately after server restart then worker process won't start and that service/application starts and after that I make request and worker process starts, leading to slow request processing.

My login activity in that application uses destination port 80.


Solution

  • When using IIS 7.0 and later, by default, the worker process is terminated after a period of inactivity.

    It is recommended to start the work process immediately after IIS is started, and set the "Startup Mode" to AlwaysRunning.

    Here is the steps:

    1. Find your site in the application pool
    2. Click Advanced Settings in the right toolbar
    3. Then set startmode to alwaysrunning

    enter image description here