While I was recently writing a Web API hosted by Windows IIS, I noticed that after using my API 30 minutes - hour after starting it, the performance was sluggish.
I understand that for the first request made to the API after starting it, there is a delay in the response since the API has to initialize DLLs, etc. But in this case, requests were sluggish after roughly 30 minutes of inactivity. Subsequent requests performed correctly, until waiting another period of time caused the slow response again.
It turns out that IIS Application Pools have a configurable Idle Timeout property to control this. Setting the Idle Timeout to 0 effectively disables the Timeout.
Open IIS Manager and browse to Application Pools.
Right-click on a particular Application Pool and click Advanced Settings.
In the "Process Model" section, change "Idle Time-out (mintues)" to a value of your choice. A value of 0 will disable the timeout.
Recycle the Application Pool to apply the changes.