There are numerous articles which talk about the easiest ways of migrating the websites from IIS 7.X to a higher version of IIS using WebDeploy.
This blog illustrates one of the ways to migrate the sites from IIS 7.X to higher version of IIS, when the content drive of the Source machine is not present in the destination.
Example: On the source box, if the Website is pointing to the physical path C:\FolderName and the requirement is to either point the website to the "D:\" drive on the destination box or if "C:\" dive is not present on the destination.
Make sure that the WebDeploy is installed on the source box and the destination box.
Steps to be followed:
1. On the source box firstly check the dependencies of the concerned web site navigating to the location where webdeploy is installed and running the below command:
msdeploy.exe -verb:getdependencies -source:apphostconfig="WebSite_Name"
Based on the output returned by this command, make sure that the dependencies are handled on the destination box.
2. Run the following command on the source server to create a package (compressed) file of the site. The package.log would have the error (if any) obtained while running the command.
msdeploy.exe -verb:sync -source:apphostconfig="WebSite_Name" -enableLink:AppPoolExtension -dest:package=c:\site.zip > package.log
3. Since the requirement here is to move the contents from C:\ drive on source machine to D:\ drive on the destination machine. We first need to find the configuration of the web site by running the "dump" operation.
msdeploy.exe -verb:dump -source:package=c:\site.zip -xml> XMLinfo.log
4. We then need to go through the XMLinfo.log and identify the configuration of the website which are dependent on the C:\ drive. Please see the small portion of the output of the xmlinfo.log file taken from my box:
<application path="/" applicationPool="DefaultAppPool" enabledProtocols="http">
<virtualDirectoryDefaults path="" physicalPath="" userName="" password="" logonMethod="ClearText" allowSubDirConfig="true" />
<virtualDirectory path="/" physicalPath="C:\inetpub\wwwroot" userName="" password="" logonMethod="ClearText" allowSubDirConfig="true">
The highlighted section is what needs to be replaced with the different drive. So we can run the below command to replace the source drive to the destination drive:
msdeploy.exe -verb:sync -source:apphostconfig="WebSite_Name" -enableLink:AppPoolExtension
5. Move the package to the destination box manually and place it any drive (here we have placed it in D:\ drive) and You need run the below command to import it:
msdeploy -verb:sync -source:package=D:\ModifiedSite.zip -dest:apphostconfig="WebSite_Name" -whatif
6. The above command will display if there are any errors.
7. You can then run the same command without the -whatif switch. And there you go..!! You have successfully migrated the website.
Author: Naveen Baliga