Eight Key Practices for ASP.NET Deployment : Page 4
Discover some best practices for deploying ASP.NET applications as well as a few useful procedures that you can follow to improve your application's performance.
by Joydip Kanjilal
Jun 27, 2008
Page 4 of 4
6. Pre-Compile Your Sites
You can use the ASP.NET 2.0 Precompilation feature to minimize the initial load time of your web pages, and avoid having to deploy your source code to the server. Precompilation is a great new feature that can detect and provide warnings about any compilation failure issues. It lets you deploy applications without having to store any source code on the deployment server. Precompilation can both reduce application response time and improve performance. A full discussion of precompilation is beyond the scope of this article, but you can learn more in this article.
7. Reduce File Sizes
It's generally a good practice to squeeze extra white space and other unwanted characters from your web pages, script, and style sheets to minimize response size. You can also compress the rendered response to reduce network bandwidth and improve performance using IIS compression. Although there is a slight performance penalty for using IIS compression (compression requires extra processing), it's still a good practice, because the performance penalty is negligible compared to the huge benefit you get from it; compression can reduce network bandwidth by nearly 50 percent! This article provides more information on file size reduction and IIS HTTP compression.
8. Take Advantage of Click-Once Deployment and Automated Updates
Click-Once deployment is a strategy introduced with Microsoft .NET 2.0 that you can use to deploy an application to a file system, local web server, remote web site, or FTP site.
The essence of Click-Once is that you have an application on the client that can detect when updates are available and download them, allowing you to configure your application to get updates securely and periodically over the internet. Click-Once provides you with lower costs and automated updates with no version conflicts! You can use the Click-Once deployment strategy to provide hot updates to the application, downloading and installing only libraries that have changed. However, there may be situations when Click-Once does not work the way you expected. For example, if a client's browser's proxy server has already cached an older version of the deployment file, that client might not get the updates as expected. Use HTTP content expiration to mitigate such issues.
Some Final Points
Before you deploy your application, ensure that the Compilation Debug attribute is set to false in your application's web.config file. When set to true, your application consumes more memory and processing time, and scripts and images downloaded from the web server do not get cached locally.
Build your assemblies in Release mode before you deploy the application to the production server.
Ensure that you allow IIS to process dynamic contents by setting the Web Service Extensions to "enabled" mode.
Ensure that you have encrypted all configuration data that your application makes use of, such as connection strings, etc.
Remember to use Http compression through IIS to compress the size of the rendered response and improve overall application performance.
Finally, it's advisable to prepare a checklist that lists the deployment steps you have chosen follow; you can cross-check against that list to ensure that you haven't skipped any steps.
As you can see, there are plenty of strategies for deploying ASP.NET applications to a production environment. By being aware of the options, selecting the best deployment model for your application, preparing a checklist, and using it to verify if the best practices documented there, you'll find that production deployments can go very smoothly.
Joydip Kanjilal has over 10 years of industry experience with C, C++, Java, C#, VB, VC++, ASP.Net, XML, Design Patterns, UML, etc. He currently works as a senior project leader in a reputable multinational company in Hyderabad, India, and has contributed articles on .NET and related technologies to www.aspalliance.com.