alex in a nutshell

August 1, 2007

Pre-compilation of ASP.Net web sites

Filed under: — Alex Salamakha @ 10:27 AM

Pre-compilation of ASP.Net web sites gives some nice benefits out of the box. For example,

  1. Faster response time for users, since pages and code files do not have to be compiled the first time they are requested. This is particularly useful on large sites that are updated frequently.
  2. A means to identify compile-time bugs before users see a site.
  3. The ability to create a compiled version of the site that can be deployed to a production server without source code.

Let’s discuss these points.

  1. It’s a nice feature to have but there are other tools to hit every page of the web site as after deployment which will achieve the same result. Moreover, web site testing tools like Selenium can do the same job as well as verify the functionality according to pre-defined tests.
  2. If you’re using a tool like Selenium, this is covered. Also, nothing is stopping you from integrating pre-compilation into your build process for the sake of checking for errors, but deploy the original version if required. And integrating Selenium or any other similar tool into your build process will do a much better job.
  3. This is only required if you deploying to a client and want to keep your intellectual property protected. It doesn’t apply to a lot of cases.

By now you probably sense my antagonism towards pre-compilation. Why? Because of the deployment restrictions it creates with regards to hot fixes. Even if you pre-compile for deployment and update, this is what can be done with the .ASPX files:

You can change the layout of .aspx files and add elements that do not require code, such as HTML elements and ASP.NET server controls without event handlers. You can also add new .aspx files, which will be compiled normally on first request.

Which basically mean that you can hot fix a typo in HTML mark up, but that’s about it. No code changes at all!!! Consider this before you implement it in a corporate environment, where every change requires authorisation and deploying the new version of the entire pre-compiled web site is not an option outside of scheduled release process.

Copyright © 1997-2015 Alexei Salamakha. All rights reserved
email: alex@salamakha.com    Alex Salamakha on Facebook    Alex Salamakha on LinkedIn