IT:AD:MSDeploy:HowTo:Backup a Remote Website
Summary
Backing up IIS's metadata only is backing up the structure of the websites and bindings.
To be safe, one has to backup the website we are about to replace.
Process
If on the same machine, we sync the local app to a local folder as follows:
# create a folder copy
msdeploy -verb:sync -source:apphostconfig="Default Web Site\Test" -dest:archiveDir="c:\bck\"
Notice that the above just creates a directory.
To create a package:
# or create a zip:
msdeploy -verb:sync -source:apphostconfig="Default Web Site\Test" -dest:package="c:\bck2\bck.zip"
If we are remoting, we have to add computer, etc. information, to backup the remote server to a local zip:
msdeploy -verb:sync -source:apphostconfig="Bwainz.com",computername=192.168.0.2,userName=Administrator,password=Passw0rd1 -dest:archiveDir="c:\bck\"
or
msdeploy -verb:sync -source:apphostconfig="Bwainz.com",computername=192.168.0.2,userName=Administrator,password=Passw0rd1 -dest:package="c:\bck2\bck.zip"
Outputs
The result – whether in a directory or zip will be:
- Contents folder (that contains the application files)
- Archive.xml
- all of the configuration and registry information related to the Web site
- No ACL?
- SystemInfo.xml
- IIS-related system information that includes operating system version, Windows directory location, computer name, free drive space, IIS version, and a list of installed IIS
Archive.xml
<?xml version="1.0" encoding="utf-8"?>
<MSDeploy.appHostConfig MSDeploy.ObjectResolver.dirPath="Microsoft.Web.Deployment.DirPathObjectResolver">
<appHostConfig path="Default Web Site/Test" MSDeploy.path="2" MSDeploy.MSDeployLinkName="Child1" MSDeploy.MSDeployKeyAttributeName="path" MSDeploy.MSDeployProviderOptions="H4sIAAAAAAAEAE2QT0sDMRDFd7UbKOqhh97zAZbYurZ62VN7EKR/wKIHT9nurAbTJCSTln56ncCizuHNY4bh95gsz7Lsmyr1VNcXJO8rtfc22A7FCRrRgtP2fACDJX8FH5Q19YOYiomYlHwRNUYPtYGIXuqSb2Oj1f4Zzjv7Baaupk1XPc7msq3m91DNikS6+wO8EWD5C/hnt94eVQt+45CAYZDCuX62lgcYOImfhSEX2FHqCCHPGUvx2SXJjXTuyQZcWNOpD5bOx0voJMXlxOQvCuF2BwGHBa2GjGRU9E8Ysd5c/QBO9a9wIAEAAA==">
<application path="/Test" MSDeploy.path="2" applicationPool="DefaultAppPool" MSDeploy.applicationPool="1" enabledProtocols="http" MSDeploy.enabledProtocols="1" serviceAutoStartEnabled="false" MSDeploy.serviceAutoStartEnabled="1" serviceAutoStartProvider="" MSDeploy.serviceAutoStartProvider="1" MSDeploy.MSDeployLinkName="PathElement" MSDeploy.MSDeployKeyAttributeName="path">
<virtualDirectoryDefaults path="" MSDeploy.path="1" physicalPath="" MSDeploy.physicalPath="9" userName="" MSDeploy.userName="1" password="" MSDeploy.password="1" logonMethod="ClearText" MSDeploy.logonMethod="1" allowSubDirConfig="true" MSDeploy.allowSubDirConfig="1" MSDeploy.MSDeployLinkName="virtualDirectoryDefaults" />
<virtualDirectory path="/" MSDeploy.path="2" physicalPath="%SystemDrive%\inetpub\wwwroot\Test" MSDeploy.physicalPath="8" userName="" MSDeploy.userName="1" password="" MSDeploy.password="1" logonMethod="ClearText" MSDeploy.logonMethod="1" allowSubDirConfig="true" MSDeploy.allowSubDirConfig="1" MSDeploy.MSDeployKeyAttributeName="path">
<MSDeploy.dirPath path="C:\inetpub\wwwroot\Test" MSDeploy.MSDeployLinkName="Microsoft.Web.Deployment.ContentExtension" />
</virtualDirectory>
</application>
</appHostConfig>
</MSDeploy.appHostConfig>
SystemInfo.xml
<systemInfo osVersion="6.1" winDir="C:\Windows" machineName="SKYSW7LT" processorArchitecture="x64" msdeployVersion="1.0" buildVersion="7.1.1631.0">
<iisSystemInfo iisMajorVersion="7" iisMinorVersion="5">
<aspNetVersionInfo>
<aspNetVersion version="2.0.50727.0" />
<aspNetVersion version="4.0.30319.0" />
</aspNetVersionInfo>
<installedComponentInfo>
<installedComponent name="ASP" installed="False" />
<installedComponent name="ASPNET" installed="True" />
<installedComponent name="Authorization" installed="False" />
<installedComponent name="BasicAuthentication" installed="True" />
<installedComponent name="CGI" installed="False" />
<installedComponent name="ClientCertificateMappingAuthentication" installed="False" />
<installedComponent name="CustomLogging" installed="False" />
<installedComponent name="DefaultDocument" installed="True" />
<installedComponent name="DigestAuthentication" installed="False" />
<installedComponent name="DirectoryBrowse" installed="True" />
<installedComponent name="FTPServer" installed="False" />
<installedComponent name="HttpCompressionDynamic" installed="True" />
<installedComponent name="HttpCompressionStatic" installed="True" />
<installedComponent name="IPSecurity" installed="False" />
<installedComponent name="IISCertificateMappingAuthentication" installed="False" />
<installedComponent name="HttpTracing" installed="True" />
<installedComponent name="HttpRedirect" installed="True" />
<installedComponent name="HttpLogging" installed="True" />
<installedComponent name="HttpErrors" installed="True" />
<installedComponent name="ISAPIExtensions" installed="True" />
<installedComponent name="ISAPIFilter" installed="True" />
<installedComponent name="LoggingLibraries" installed="True" />
<installedComponent name="Metabase" installed="True" />
<installedComponent name="NetFxEnvironment" installed="True" />
<installedComponent name="NetFxExtensibility" installed="True" />
<installedComponent name="ODBCLogging" installed="False" />
<installedComponent name="ProcessModel" installed="True" />
<installedComponent name="RequestFiltering" installed="True" />
<installedComponent name="RequestMonitor" installed="True" />
<installedComponent name="ServerSideInclude" installed="False" />
<installedComponent name="StaticContent" installed="True" />
<installedComponent name="W3SVC" installed="True" />
<installedComponent name="WindowsAuthentication" installed="True" />
<installedComponent name="CertProvider" installed="False" />
<installedComponent name="AppWarmUpBeta" installed="False" />
<installedComponent name="dynamicIPRestrictionsBeta" installed="False" />
</installedComponentInfo>
</iisSystemInfo>
</systemInfo>
Differences between Archive and Package
Note:
The zip and folder both differ from a package generated by Visual Studio in that
- the Visual Studio package will contain a
parameters.xml(as Visual Studio can see it as part of the project, whereas IIS doesn't have it there to include). - Outside the zip, Visual Studio will also create:
- A readme on how to use the *.cmd file
- The *.cmd file
- A {ProjectName}.SetParameters.xml
- A {ProjectName}.SourceManifest.xml containing something like:
<?xml version="1.0" encoding="utf-8"?> <sitemanifest> <IisApp path="Z:\Dropbox\Code\Spikes\XAct.Spikes.WebDeploy05\XAct.Spikes.WebDeploy05\obj\Release\Package\PackageTmp" managedRuntimeVersion="v4.0" /> <setAcl path="Z:\Dropbox\Code\Spikes\XAct.Spikes.WebDeploy05\XAct.Spikes.WebDeploy05\obj\Release\Package\PackageTmp" setAclResourceType="Directory" /> <setAcl path="Z:\Dropbox\Code\Spikes\XAct.Spikes.WebDeploy05\XAct.Spikes.WebDeploy05\obj\Release\Package\PackageTmp" setAclUser="anonymousAuthenticationUser" setAclResourceType="Directory" /> </sitemanifest>
Warning
Important: Note that the above is only backing up the WebSite...not the database.