Migrating IIS Sites Using Web Deploy

What Can Be Migrated?

Step 1: Installing Web Deploy

  1. Download Web Deploy:

  2. Install Web Deploy:

    • Run the downloaded installer with administrative privileges (right-click and choose “Run as administrator”).

    • Follow the installation wizard:

      • Accept the license terms.

      • Choose the installation location (you can leave it as the default).

      • Select the components to install. Make sure to select at least the following:

        • Web Deployment Tool

        • IIS Deployment Handler

        • Management Service Delegation UI

      • Click “Install” to begin the installation.

Step 2: Configuring IIS for Web Deploy

  1. Open IIS Manager:

    • Press Win + R, type inetmgr, and press Enter to open the Internet Information Services (IIS) Manager.

  2. Enable Management Service:

    • In IIS Manager, select your server node (usually the top node in the Connections pane on the left).

  3. Double-Click on “Management Service” under the “Management” section in the middle pane.

  4. Configure Management Service:

    • Check the “Enable remote connections” checkbox to allow remote management of the IIS server.

    • Set the “Start Type” to “Automatic” to ensure the service starts automatically with Windows.

    • Specify a unique port for the management service (default is 8172).

    • You can also configure other settings like SSL and client certificates if needed.

  5. Configure Permissions:

    • Under “Management Service Delegation,” you can configure permissions for various users and roles. Click “Add User…” to specify the users or groups that should have permission to deploy websites.

  6. Apply Changes:

    • Click the “Apply” button to save your configuration.

Step 3: Exporting and Importing Websites with Application Pools

Now that Web Deploy is installed and IIS is configured, you can use Web Deploy to export and import websites with application pools.

Export a Website:

  1. Open a Command Prompt:

    • Press Win + X and choose “Command Prompt (Admin)” to open a command prompt with administrative privileges.

  2. Run the Export Command:

    • Use the msdeploy command to export a website. Replace placeholders with actual values:

# Export all sites with application pools
msdeploy -verb:sync -source:webServer,computerName=<ServerName>,userName=<Username>,password=<Password> -dest:package=<PathToPackage.zip> -enableRule:AppPoolExtension

OR

# Export only one site
msdeploy -verb:sync -source:iisapp="Default Web Site" -dest:package="C:\backup\defaultsite.zip"
  • <ServerName>: Replace with the server name or IP address.

  • <Username> and <Password>: Replace with the credentials of an account with sufficient permissions.

  • <PathToPackage.zip>: Specify the path where you want to save the exported package.

Import a Website:

  1. Open a Command Prompt:

    • Open a command prompt with administrative privileges.

  2. Run the Import Command:

    • Use the msdeploy command to import a website. Replace placeholders with actual values:

msdeploy -verb:sync -source:package=<PathToPackage.zip>,includeAcls=“False” -dest:webServer,computerName=<ServerName>,userName=<Username>,password=<Password>

OR

msdeploy -verb:sync -source:package="C:\backup\defaultsite.zip" -dest:auto,computerName="localhost"
  • <PathToPackage.zip>: Specify the path to the package you want to import.

  • <ServerName>: Replace with the server name or IP address.

  • <Username> and <Password>: Replace with the credentials of an account with sufficient permissions.

  1. Execute the Command:

    • Execute the command, and the website with its associated application pool will be imported to the target server.

Useful Commands


REFERENCES

Last updated

Was this helpful?