How to: Configure Published Web Sites
Publishing a Web site compiles the executable files in the Web site and then writes the output to a folder that you specify. Because of configuration differences between your test environment and the location where you publish your application, the published application might behave differently than application does in the test environment. If so, you might need to change configuration settings after publishing the site. For more information, see Configuring ASP.NET Applications.
To configure a published Web site
Check the configuration of your original site and note the settings that need to be made for the published Web site. Settings that commonly differ between a development site and a production site include:
Membership settings and other security settings. For details, see Configuring an ASP.NET Application to Use Membership.
Debugging settings. It is recommended that you turn debugging off for all pages on a production server.
Tracing. It is recommended that you turn tracing off. For details, see ASP.NET Tracing.
Custom errors. For details, see Error Handling in ASP.NET Pages and Applications.
Because configuration settings are inherited, you might need to look at local versions of the Machine.config file or the root Web.config file in the %SystemRoot%\Microsoft.NET\Framework\version\CONFIG directory as well as in any Web.config files in your application.
If you do not have permission to view the root configuration files, you can create a file that contains a complete list of configuration settings for your Web site, formatted as a configuration file, using the code described in How to: View Inherited and Local Configuration Settings Programmatically.
After you publish a Web site, test all of the Web pages of your published site under different user accounts.
If your published Web site behaves differently than the original, you might need to make configuration changes on the published site.
To view configuration settings on the published site, open the remote site in Visual Web Developer and edit the remote site's Web.config file directly. Alternatively, you can use the other configuration methods described in Editing ASP.NET Configuration Files.
You cannot use the Web Site Administration Tool to configure remote Web sites.
Compare the configuration settings of the published Web site to those of the original Web site. On the Web server where the published site is located, you might need to look at the Machine.config file or the root Web.config file in the %SystemRoot%\Microsoft.NET\Framework\version\CONFIG directory of the remote computer in addition to your application's Web.config file. You can create a file that contains a complete list of configuration settings for your Web site, formatted as a configuration file, using the code described in How to: View Inherited and Local Configuration Settings Programmatically.
In the configuration file of the published site, edit the deployment element and set its retail attribute to true.
This overrides the local settings for tracing and debug mode in the page or in an application-level Web.config file, which improves the security of the Web site to fit into a production environment.
Encrypt sensitive configuration settings such as security settings and connection strings. For more information, see Encrypting Configuration Information Using Protected Configuration.