IIS 7.5 web application first request after app-pool recycle very slow
This is somewhat hard to tell whats going on on your other server, however here's a simple checklist you might want to reconsider:
Always pre-compiling your site, as opposed to copying it! you might gain a significant performance boost compiling your website before deployment: ASP.NET Precompilation Overview
Do not run the production application with
debug="true"
enabled, when debug flag is true in your web.config, Much more memory is used within the application at runtime, and since some additional debug paths are enabled, codes can execute much slowerCheck your Web.config file to ensure trace is disabled in the
<trace>
sectionIIS 7.5 comes with the Auto-Start Feature. WAS (Windows Process Activation Service) starts all the application pools that are configured to start automatically, ensure that your application pool is configured to
AlwaysRunning
in the IIS 7.5applicationHost.config
, check out here for more detailCheck out the
ASPNET.CONFIG
file to see if the configuration on both servers are still the same. Every asp.net server can be well configured byaspnet.config
file located in the root of the framework folderEnsure that Publisher Evidence for Code Access Security (CAS) is set to false in your aspnet.config file, This might increase the initial page load when you restart the ASP.NET app pool. you can read more about it here.
Here's how to disable checking for CAS publisher policy for an application:
<configuration>
<runtime>
<generatePublisherEvidence enabled="false"/>
</runtime>
</configuration>
- also you might want to try Application Initialization Module for IIS 7.5, this module also available on IIS 8.0 can decrease the response time for first requests by pre-loading worker processes
MrJoeBlow
Updated on June 11, 2022Comments
-
MrJoeBlow almost 2 years
We have our website running on two machines with iis 7.5 One works fine.
The other one how ever takes a really long time to process the first request after an app-pool recycle. It can take upwards of 60secs which is unacceptible since its going to be used as our production server.
I've checked the app-pool settings on the both servers and they are the same, and the webapp version on both servers is the same. I've run the task manager and resource monitor, add see a connection to the machine when I make the request but nothing else happens, iis doesn't even show the request in the logs untill its completed. I don't really know what its doing in the mean time.
Are there any traces of settings we can try to play with to fix this or find the problem. It's very puzzling.
EDIT: So I've got some more information now, finall got the failed request logs to work (had to give the user IIS_IUSRS permissions) but I've got some logs to see whats going on
The time lost is inbetween two seconds in the log file.
1. MODULE_PRECONDITION_NOT_MATCH Name="ScriptModule-4.0", Precondition="managedHandler,runtimeVersionv4.0" 12:09:46.422 2. VIRTUAL_MODULE_UNRESOLVED Name="FormsAuthentication", Type="System.Web.Security.FormsAuthenticationModule" 12:12:04.390
As you can see it takes over 2 minutes inbetween those two events, anyone encounted this before?
-
MrJoeBlow over 11 yearsThanks. I'll go through this list and hopefully something will come of it. I will reply once done.
-
slashNburn over 5 yearsSix years later, the suspense is killing me!
-
Kamyar Nazeri over 5 years@slashNburn Not sure if this applies to you, but if you are using EntityFramework, then part of the suspense is to compile the edmx to sql!