Lajos Arpad Lajos Arpad - 3 months ago 10
ASP.NET (C#) Question

.NET build slows first page load significantly

I am working on a .NET WebForms application and I have observed that whenever I build, after the build, the very first page load takes longer to load than usually. This happens even if I wait after building before I load a page. Is there a way to increase human workforce performance by changing IIS/.NET to initialize things on postbuild instead of first page load?

Answer

Yes you can, like this. Quoting:

You can use Application Initialization Module which comes in-box with IIS 8.0, like this:

<applicationInitialization
     doAppInitAfterRestart="true" >
   <add initializationPage="/" />
</applicationInitialization>

This will send a request to the root of your app (initializationPage="/") every time your app starts automatically.

You can also configure the Start Mode for your application pool to Always Running which means every time IIS restarts, it will make sure to start your application pool immediately (this if from right click on your application pool then Advanced Settings).