1

I have a zip file on source server in a shared location and, using msdeploy, I would like to copy it to the destination server. However, if for the first time, the site does not exist on the destination server, then it should create the website as well. Both source and destination servers are IIS 6.0 on Windows Server 2003.

I have tried using different combination of providers e.g.

msdeploy.exe -verb:sync -source:package="\\SourceServer\WebSites\Site1.zip" -dest:metakey="Site1"

I am getting the following message:

Error: Source (contentPath) and destination (metaKey) are not compatible for the given operation.

I have also tried creating the website on the destination first from the default website, then copy the files across, but then I don't know how to make the new website Site1 point to this new directory:

  1. msdeploy.exe -verb:sync -source:metakey="Default Web Site" -dest:metakey="Site1"
  2. msdeploy.exe -verb:sync -source:package="\\SourceServer\WebSites\Site1.zip" -dest:contentpath="\\DesitnationServer\WebSites\Site1"
  3. How to make the new website Site1 point to the new directory "\DesitnationServer\WebSites\Site1" ?

Even if I follow the above steps, I do not want to perform step 1 and 2 everytime I deploy Site1.

I am sure there must be an easy way to do this? Any idea?

nabeelfarid
  • 4,156
  • 5
  • 42
  • 60

2 Answers2

2

Problems!

  • Your source package is a content-only backup (not settings (I assume from "contentpath")) - you can't mix a backup from one provider with a restore to another provider (except in special cases).
  • Your "metakey" syntax isn't a metabase key location I've seen before - it has to be a site identifier based on the site location in the metabase (for eg, Default Web Site would be "/lm/w3svc/1" )

There's a walkthrough of what you want to do here. Give that a try!

(Skip to the bottom-most section for the bit that most closely resembles what you're trying to do: "Optional - Synchronize your site to the target by using a package file")

TristanK
  • 527
  • 2
  • 10
  • Thanks for the reponse tristan, I have actually been through the tutorial you have mentioned. The only difference is that the source in my case is a content-only backup. Its actually a simple zip file of the ouput generated after compiling the website solution. I have tried to create a package using msdeploy from the content folder using: msdeploy -verb:sync -source:contentpath="\\server\websitecontentfolder\" -dest:package=c:\Site1.zip and it does create the package. However when i tried to restore it, I get the same compatibility error. – nabeelfarid Mar 22 '11 at 12:15
  • so if the source provider (which in my case is a simple content folder) is not the same as destination folder (iis 6.0 website metakey), then how should I do go about doing this? – nabeelfarid Mar 22 '11 at 12:18
  • I can do simple x-copy but then again, the whole point of doing it using msdeploy was to make sure that I can do things cleanly as part of my deployment script e.g.if the website does not exist on the destination in the first place, msdeploy should create it as well, which app pool to use, what physical directory to point, setup the host headers etc – nabeelfarid Mar 22 '11 at 12:25
  • So you're actually syncing the website, not just the content, so my suggestion would be to back up and restore from the metakey location. Doing site-level operations, including settings where necessary, is what MSDeploy is designed to do. In the case where nothing has changed, it changes nothing. Have you tried doing a whole-site backup? (this would include both the content and the settings describing the site, whereas the content doesn't describe that) – TristanK Mar 22 '11 at 13:24
  • And you could restore it with target:contentpath=blah; that'd be akin to doing an XCOPY. If an xcopy isn't what you want, don't use a content-only provider? – TristanK Mar 22 '11 at 13:26
  • No I am not syncing the website from one IIS to another. As I mentioned, the source is just a folder that contains the compiled output of a visual studio website solution. This folder is not connected to any iis website. – nabeelfarid Mar 22 '11 at 14:46
  • Now what I would like to do is to deploy this source folder on a destination server (2003) with IIS6. I should be able to tell msdeploy to copy this source folder on the destination server at a particular location, create a website for it with a particular name if it does not already exist, create host header, create app pool etc. Next time when I deploy the same source folder, it should not recreate the website and all that, instead only sync the contents(files&folder). Does it make sense now? – nabeelfarid Mar 22 '11 at 14:47
  • Yep, sorry, I misunderstood the bit about "website solution". I think you're going to need to use some sort of website template to do that originally; MSDeploy doesn't support pushing website parameters via command line (AFAIK). So you'd have a site backup of just the settings you wanted to deploy, and then a content backup that could be deployed into an arbitrary site. the content backup is restorable as-is, it's just not got any site information around it. – TristanK Mar 22 '11 at 22:50
2

You have to use iisApp MSDeploy provider with destination. iisApp provider is compatible with both IIS 6 and 7 whereas appHostConfig is compatible with IIS 7 only. So give the below a try

msdeploy.exe -verb:sync -source:package="\\SourceServer\WebSites\Site1.zip" -dest:iisApp="Site1"
DotNetInfo
  • 3,344
  • 6
  • 33
  • 39