OdeToCode IC Logo

Precompilation in ASP.NET 2.0

Wednesday, June 22, 2005

New article on OdeToCode: Precompilation in ASP.NET 2.0. Here is an excerpt:

Although pre-compilation will give our site a performance boost, the difference in speed will only be noticeable during the first request to each folder. Perhaps a more important benefit is the new deployment option made available by pre-compilation - the option to deploy a site without copying any of the original source code to the server. This includes the code and markup in aspx, ascx, and master files.

Other notes:

It seems the precompile.axd 'magic page' touted as a feature in the early days has slipped quietly into the bucket of dropped features.

Although pre-compilation allows you to deploy a web application without any ASPX files present, this still poses a problem if a request comes in for a directory and you want the request to find a default document for the directory. The 'default document' issue has been a thorn in the side of url-rewriters for quite some time.

If you try to pre-compile to a target directory that already contains a pre-compiled application, the aspnet_compiler will fail with “error ASPRUNTIME: Object reference not set to an instance of an object”. Ugh - unhelpful. Use the –f switch in this case to force an overwrite.