Share via

How to: Prepare to Deploy a Web Project

Before you deploy or redeploy a Web project, you might want to prevent the production site from responding to page requests during the deployment process. This can help avoid errors that might result during the time when the changes are only partially completed. Also, when changes occur to some file types and folders, the application domain restarts, and you might want to make sure that this does not happen multiple times.

To take a Web application offline before deployment

  1. Create a file called App_offline.htm and include a message in the file that lets users know that the site is unavailable because you are updating the site.

  2. Place the App_offline.htm file in the root folder of the target Web site.

    While the App_offline.htm file exists in the root of your Web site, any request to the Web site will redirect to that file.

    When you have finished deploying the site, remove the App_offline.htm file.

To minimize the number of times your application domain restarts

  1. Open the Web.config file for your Web application. If you do not have a Web.config file, you can create one by following these steps:

    1. In Solution Explorer, right-click the Web site name.

    2. Select Add New Item.

    3. Select the Web Configuration File template.

    4. Click Add.

    For more information about configuration files, see ASP.NET Configuration Files.

  2. If you expect to submit multiple copy commands and there might be a time interval between them, you might not want the application domain to restart between copy commands. To prevent a restart, configure the Web.config file to delay the application domain restart. Add an httpRuntime Element (ASP.NET Settings Schema) element to the Web.config file and set the waitChangeNotification attribute to the number of seconds to wait to ensure that the application domain does not restart between copy commands. For example, if you want to specify a five-second wait time, the httpRuntime element might look like the following example.

            <compilation debug="false" targetFramework="4.0" />
          waitChangeNotification="5" />
  3. If you want to ensure that the application domain restarts within a certain interval after the first copy command executes, add a maxWaitChangeNotification attribute to the httpRuntime element and set it to the maximum number of seconds to wait. For example, a Web.config file that has the httpRuntime element with both attributes might look like the following example.

          maxWaitChangeNotification="10" />

See Also


ASP.NET Deployment Content Map