Labels

Wednesday, April 4, 2007

Why Pre-Compilation is required?


When the first request arrives at your web application there is a mind-numbing amount of work to do.
  • The worker process starts,
  • The runtime initializes.
  • ASPX pages are parsed and compiled to intermediate language,
  • Methods are just-in-time compiled to native code -
  • And the list goes on and on............
By default below happens when first request arrives for a page inside a folder:

  • ASP.NET dynamically parses and compiles all the ASPX pages in a folder.
  • ASP.NET also needs to compile applicable files in the special folders, like App_Code.
  • Any code-behind files associated with ASPX and ASCX files.
The runtime caches all the compilation results in order to quickly process later requests, and does not need to recompile again unless someone edits a file. Although of this flexibility, still there is the performance hit on the first request.


If you want to cut out some of the overhead and improve the startup time of your application, then you’ll want to look at the precompile features in ASP.NET 2.0.

There is two provisions for Pre-Comiplation.
  • In Place Pre-compilation :
    1. Used in Development Environment.
    2. aspnet_compiler.exe -v /<Existing Virtual Directory Name>
e.g. aspnet_compiler.exe -v /BSEU.TyreLink.Web

  • Pre-compilation For Deployment
    1. Used at the Deployment time.
    2. aspnet_compiler.exe -p / -v / < Existing Source Path > -v / < Destination Path >
e.g. aspnet_compiler.exe -p "E:\Project Apps\BSEU.TyreLink\BSEU.TyreLink.Web" -v /"C:Inetpub\wwwroot\TyreLinkSetup\\"
Note : M.M Imp

However this all can be achieved using IDE as well. For this you need to Publish the Site, and choose the options accordingly.


Hope it is clear now...

Regards,
Arun


Ref: http://odetocode.com/Articles/417.aspx

No comments:

Post a Comment