How to Backup and Restore a Website in IIS Using Web Deploy: A Step-by-Step Guide
Published Aug 27 2024 02:58 PM 1,625 Views
Microsoft

There are many ways to back up and restore a website hosted on IIS. In this article, we’ll focus on using Web Deploy to back up and restore an IIS site.

 

Prerequisites

 

Before you begin, you’ll need to install Web Deploy. This tool streamlines the migration, management, and deployment of IIS Web servers, Web applications, and Web sites. You can download Web Deploy from the official link here: Web Deploy : The Official Microsoft IIS Site

 

Backup
 
To create a backup of an IIS site, follow these steps. In this example, we'll be backing up the "Default Web Site."
 

1. Open Command Prompt as Administrator:


○ Open the Command Prompt with administrator privileges.
○ Navigate to the Web Deploy installation directory. For this example, it’s located at  C:\Program Files\IIS\Microsoft Web Deploy V3.
○ Look for msdeploy.exe in this directory. If you find it, you’re in the right place.

 

2. Run the Backup Command:

 

○ Once you're in the correct directory, execute the following command to create the backup:

msdeploy -verb:sync -source:appHostConfig="Default Web Site" -dest:package="C:\Backup\DefaultWebSiteBackup.zip"
hridaydutta_0-1724754222295.png

Replace "Default Web Site" with the name of your site. The package parameter determines the location and name of the backup file. To confirm the backup was successful, go to the specified backup location and ensure the .zip file has been created.

 

Restore
 

You can restore the backup on the same server or a different one. If you’re restoring it to a different server, copy the backup .zip file to the destination server. If the site already exists, it will be overwritten by the backup; if the site doesn’t exist, a new one will be created.
Open Command Prompt with administrator privileges and navigate to the Web Deploy installation directory. Then, execute the following command:   

 

msdeploy -verb:sync -source:package="C:\Backup\DefaultWebSiteBackup.zip" -dest:appHostConfig="Default Web Site"
hridaydutta_1-1724754441415.png
Ensure that you specify the correct path to your backup file. After the restoration, verify the process by checking the IIS Manager to confirm that the site has been restored properly.

 

 

Conclusion

 

Backing up and restoring websites in IIS using Web Deploy is a straightforward and efficient process. By following the steps outlined in this guide, you can ensure that your website data is securely backed up and can be easily restored, whether on the same server or a different one. This method helps you maintain the integrity of your websites and provides peace of mind knowing that your data is protected and recoverable.

 

Co-Authors
Version history
Last update:
‎Aug 27 2024 03:45 AM
Updated by: