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
1. Open Command Prompt as Administrator:
○ Open the Command Prompt with administrator privileges.
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"
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.
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"
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.