tryandcatch.net

Blogs from tryandcatch.net
Welcome to tryandcatch.net Sign in | Join | Help
in Search

Juan Pablo Rizzo's Blog

How to speed up the first request to an ASP.NET page

Are you tired of waiting a few seconds in the first request to your deployed application?

You can avoid that now with the ASP.NET Web Site Precompilation. With this tool you can deploy your ASP.NET application already compiled to production servers. All .aspx and .ascx files will be compiled (and copied to bin directory with .compile extension) and the original file will remaing in its location but with content stripped. All assemblies will be generated and copied to the bin directory also. Static files (images, htmls, etc.) will be just copied.

To use this tool just follow these steps:
1- Open a command window
2- Go to the folder containing the .NET Framework
3- Type "aspnet_compiler -v virtualpath targetpath" where virtualpath is the virtual directory in IIS where the application resides and targetpath is the physical directory where the compiled application will be created.
If you don't have IIS, then the command to run is "aspnet_compiler -p physicalpath -v / targetpath" where physicalpath is the full path in which the web application is located.
4- Copy targetpath\*.* to the production servers by FTP, xcopy or something similar.

Also you can make ASP.NET to compile your application in background through a setting in the web.config file:

<compilation
   batch="true"
   batchTimeout="900"
   ...

The problem with this is that you have to copy all the source in the aspx and ascx files to your production server and you may not want that. If the compilation takes more than the batchTimeout ASP.NET will automatically switch to standard compilation mode (for page).

Published Tuesday, December 06, 2005 6:22 PM by jprizzo
Filed Under: ,
Anonymous comments are disabled

This Blog

Post Calendar

<December 2005>
SuMoTuWeThFrSa
27282930123
45678910
11121314151617
18192021222324
25262728293031
1234567

Syndication

Powered by Community Server, by Telligent Systems