LolaTheriotASP.Net Compilation Tool – do you want to allow updates without redeploying?

If we have an ASP.Net website that:
1. We want to pre-compile before deploying to the live servers for the usual reasons of performance (no delay on first hit) and security (source code not hosted on the servers)
2. Before starting the web application, we automatically generate its web.config file
3. By default we want to disable view state in all the pages by adding a
node in the generated web.config
The main issue was that even though the generated web.config file had the correct setting in it, the view state wasn’t being disabled. This confused us for quite a while.
It turns out that the default setting when a website is compiled by the ASP.Net compiler doesn’t allow subsequent updates to the site.
In our particular case, this meant the compiled pages were using the (default) value in our non-existent web.config at compile time, not the one actually on the server at runtime.
Once we realised that, the solution was easy: simply add a –u parameter to the compiler flags which meant:
-u specifies that the Aspnet_compiler.exe should create a precompiled application that allows subsequent updates of contents such as .aspx pages.
If this option is omitted, the resulting application contains only compiled files and cannot be updated on the deployment server. You can update the application only by changing the source markup files and recompiling.

Tags: , , , , ,