[Markcxz excerpt] This is the top 10 notes for publishing ASP. NET Applications (personal summary, ranking in no particular order). I hope it will be helpful for your development. You are welcome to add new ideas and projects.
In no special order, here are the top ten things I 've learned to pay attention to when dealing with production ASP. NET applications. hopefully they will help you save you some time and headaches. as always, your thoughts and additions are welcome.
- Create a new key
Generate new encryption keysWhen moving an application to production for the first time it is a good idea to generate new encryption keys. this operation des the machine validation key and decryption key as well as any other custom keys your application may be using. there is an article on CodeProject (http://www.codeproject.com/KB/aspnet/machineKey.aspx) that talks about generating machineKeys specifically that shoshould be helpful with this.
- Encrypt Sensitive Configuration nodes in web. config
Encrypt sensitive sections of your web. configThis includes des both the connection string and machine key sections. See Scott Guthrie's
Post (http://weblogs.asp.net/scottgu/archive/2006/01/09/434893.aspx) for some good references. note that if your application runs in a clustered environment you will need to share a custom key using the RSA provider as described in an MSDN article (http://msdn2.microsoft.com/en-us/library/68ze1hb2 (VS.80 ). aspx ).
- Use a trusted SQL connection
Use trusted SQL connectionsBBoth Barry Dorrans (http://idunno.org/articles/276.aspx) and Alex Chang (http://weblogs.asp.net/achang/archive/2004/04/15/113866.aspx) have articles which discuss this in detail.
- Set retail to true in machine. config.
Set retail = "true" in your machine. config<Configuration>
<System. web>
<Deployment retail = "true"/>
</System. web>
</Configuration>
TThis will kill three birds with one stone. it will force the 'debug' flag in the B. config to be false, it will disable page output tracing, and it will force the custom error page to be shown to remote users rather than the actual exception or error message. for more information you can read Scott Guthrie's post (http://weblogs.asp.net/scottgu/archive/2006/04/11/442448.aspx) or the MSDN reference (http://msdn2.microsoft.com/en-us/library/ms228298 (VS.80 ). aspx ).
- Create an independent application pool for the site
Create a new application pool for your siteWhen setting up your new site for the first time do not share an existing application pool. Create a new application pool which will be used by only by the new web application.
- Set maximum available memory for the application pool
Set the memory limit for your application poolWhen creating the application pool, specifically set the memory limit rather than the time limit which is set by default.
Http://www.asp.net has a good whitepaper (http://www.asp.net/learn/whitepapers/aspnet-and-iis6/) which explains the value of this:
By default IIS 6.0 does not set a limit on
The amount of memory that IIS is allowed to use. ASP. NET's Cache
Feature relies on a limitation of memory so the Cache can
Proactively remove unused items from memory.
It is recommended that you configure the memory reconfiguring
Feature of IIS 6.0.
- Create and use app_offline.htm files as appropriate
Create and appropriately use an app_Offline.htm fileTThere are used benefits to using this file. it provides an easy way to take your application offline in a somewhat user friendly way (you can at least have a pretty explanation) while fixing critical issues or pushing a major update. it also forces an application restart in case you forget to do this for a deployment. once again, ScottGu is the best source (http://weblogs.asp.net/scottgu/archive/2006/04/09/442332.aspx) for more information on this.
- Implement repeated and easy-to-operate deployment Functions
Develop a repeatable deployment process and automate itIt is way too easy to make mistakes when deploying any type of software. this is especially the case with software that uses configuration files that may be different between the development, staging, or production environments. I wowould argue that the process you come up with is not nearly as important as it being easily repeatable and automatic. you can fine tune the process as needed, but you don't want a simple typo to bring a site down.
- Make sure that the generated and referenced assembly is in the release version.
Build and reference release versions of all assembliesIn addition to making sure ASP. NET is not configured in debug mode, also make sure that your assemblies are not debug assemblies. there are of course exceptions if you are trying to solve a unique issue in your production environment... but in most cases you shoshould always deploy with release builds for all assemblies.
- Load TestLoad Testing
Load testThis goes without saying. Inevitably, good load testing will uncover threading and memory issues not otherwise considered.
Address: http://daptivate.com/archive/2008/02/12/top-10-best-practices-for-production-asp-net-applications.aspx