Partilhar via


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

  1. 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:

    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.

    NoteNote

    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.

    For definitions of configuration settings, see General Configuration Settings (ASP.NET) and ASP.NET Configuration Settings.

  2. 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.

  3. 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.

    NoteNote

    You cannot use the Web Site Administration Tool to configure remote Web sites.

  4. 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.

  5. 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.

  6. Encrypt sensitive configuration settings such as security settings and connection strings. For more information, see Encrypting Configuration Information Using Protected Configuration.

See Also

Tasks

Walkthrough: Deploying an ASP.NET Web Application Using XCOPY

Concepts

Editing ASP.NET Configuration Files

Other Resources

Configuring ASP.NET Applications