Backup Strategies with Web Deploy


 

Before running the Web Deploy commands to update a web site, make sure to create a backup of the target web files in case a rollback of the operation is required. The process to make a backup on the target server is quick and I would recommend adding these steps to any scripts used for deployments on an IIS server.

These scripts are run from the source server (10.0.0.11) and backing up the files on the target server (10.0.0.12) and the packages are stored on the target server in the c:\_WebDeploy folder.

Web Site Settings Backup:

The first example uses the AppCmd utility to backup the IIS settings. If a server level or web site level deployment has modifications to the IIS settings, make a backup copy of the target IIS settings to quickly restore the server if there are issues with the deployment. Again, this is for IIS settings only.

%windir%\system32\inetsrv\appcmd add backup “PreContoso_v2.1_Deployment”

Web Site Content Backup:

This command will backup all settings for the target IIS server.

Server Level Backup:

msdeploy –verb dump –source:webServer,computername=10.0.0.12 dest package=c:\_WebDeploy\Contoso_v2.1_Deployment.zip

Web Site Level Backup:

msdeploy –verb:dump -source:contentPath="Contoso.com",computername=10.0.0.12 -dest:package=c:\_WebDeploy\Contoso_v2.1_Deployment.zip

The contentPath provider uses the dirPath and filePath providers to function.

Folder Level Backup:

msdeploy –verb:dump –source:dirPath=="c:\inetput\websites\contoso\staticfiles",computername=10.0.0.12 -dest:package=c:\_WebDeploy\Contoso_v2.1_staticfiles.zip

Comments (4)

  1. Gaurav says:

    looks like the verb should be '-verb:sync' instead of '–verb:dump'

  2. Eric Parvin says:

    Yes, the -Sync command can be used as well for each of these commands.

  3. cori says:

    I’d say the limitation is stronger than just that -verb:sync *can* be used. At least with msdeploy 3.6 -verb:dump doesn’t allow the -dest parameter at all.

    With -verb:sync, though, you, you can backup to a local package using -dest:package=*.zip *or* to a remote folder using -dest:computername=%WMSVC%:8172/msdeploy.axd,package=*.zip.

    Also your :”Server Level Backup” command example is missing a few “:”, for whatever that’s worth.

    1. Eric Parvin says:

      Thanks Cori. I will take a look the command I have posted. I has been awhile since that post and I have probably have adjusted a few scripts 🙂

Skip to main content