IT:AD:WebDeploy:HowTo:Faqs/Does the target website have to exist first?
Summary
WebDeploy magic is nice – as long as it's predictable.
Is it predicatable? Yes.
The Site has to exist, but the target virtual directory does not.
Answer
If you create a Web Deploy Package on your desktop or IT:AD:Continuous Integration Server, and want to deploy it to another server, you have more than one choice:
- Use IIS's import Web Deploy Package: IT:AD:WebDeploy:HowTo:Manually Deploy a Package on a Target IIS
- See pros/cons of this here: For Deploying
- Use the default Web Deploy .cmd script * See pros/cons of this here: For Deploying Create a beefier custom script
If You create a Web Deploy Package and use the *.cmd script
The Site (ie, Application) Will Need to be there first
You'll find that you'll get an ERROR_SITE_DOES_NOT_EXIST because the target web site needs to exist first:
Z:\Dropbox\...\ExampleSite\Packages>a.deploy.cmd /Y
SetParameters from:
"Dropbox\...\ExampleSite\Packages\ExampleSite.SetParameters.xml"
You can change IIS Application Name, Physical path, connectionString or other deploy parameters in the above file.
-------------------------------------------------------
Start executing msdeploy.exe
-------------------------------------------------------
"C:\Program Files\IIS\Microsoft Web Deploy V3\msdeploy.exe"
-source:package='Z:\Dropbox\...\ExampleSite\Packages\ExampleSite.zip'
-dest:auto,includeAcls="False"
-verb:sync -disableLink:AppPoolExtension -disableLink:ContentExtension -disableLink:CertificateExtension
-setParamFile:"Z:\Dropbox\...\ExampleSite\Packages\a.SetParameters.xml"
Info: Adding sitemanifest (sitemanifest).
Info: Creating application (NonExistentWebSite\ExampleSite)
Info: Adding virtual path (NonExistentWebSite\ExampleSite)
Error Code: ERROR_SITE_DOES_NOT_EXIST
More Information: Site 'NonExistentWebSite' does not exist. Learn more at: http://go.microsoft.com/fwlink/LinkId=221672#ERROR_SITE_DOES_NOT_EXIST.
Error count: 1.
The Virtual Directory Will be Created as Needed
But if the site exists, it will happily create a Virtual directory in the target website:
Z:\Dropbox\...\ExampleSite\Packages\>a.deploy.cmd /Y SetParameters from: "Z:\Dropbox\...\ExampleSite\Packages\ExampleSite.SetParameters.xml" You can change IIS Application Name, Physical path, connectionString or other deploy parameters in the above file. ------------------------------------------------------- Start executing msdeploy.exe ------------------------------------------------------- "C:\Program Files\IIS\Microsoft Web Deploy V3\msdeploy.exe" -source:package='Z:\Dropbox\...\ExampleSite\Packages\ExampleSite.zip' -dest:auto,includeAcls="False" -verb:sync -disableLink:AppPoolExtension -disableLink:ContentExtension -disableLink:CertificateExtension -setParamFile:"Z:\Dropbox\...\ExampleSite\Packages\ExampleSite.SetParameters.xml" Info: Adding sitemanifest (sitemanifest). Info: Creating application (Default Web Site\TestA) Info: Adding virtual path (Default Web Site\TestA) Info: Adding directory (Default Web Site\TestA). Info: Adding directory (Default Web Site\TestA\bin). Info: Adding file (Default Web Site\TestA\bin\XAct.Spikes.WebDeploy06.dll). Info: Adding file (Default Web Site\TestA\index.html). Info: Adding file (Default Web Site\TestA\Parameters.xml). Info: Adding file (Default Web Site\TestA\Web.config). Info: Adding ACL's for path (Default Web Site\TestA) Info: Adding ACL's for path (Default Web Site\TestA) Total changes: 11 (10 added, 0 deleted, 1 updated, 0 parameters changed, 5733 bytes copied)
Using IIS Import
The Site (ie, Application) Will Need to be there first
Regarding whether the target site has to exist first before importing a WebPackage, the answer is moot – it's yes, because of the following reason:
But if there is a site, it will happily create the target site, with the name you gave in the input dialog.
You can't override it either:
The Virtual Directory Will be Created as Needed
It goes without saying that IIS will create the Virtual Directory just fine.




