Question

I am trying to automate the deployment of sites with appcmd.

I have the website and app pools working correctly. I get the settings in a xml config file with:

appcmd list site "bleh" /config /xml

I save these off to xml files and will go into Source control. I create the sites and app pools with a command such as:

appcmd add site /IN < fileWithSiteSettings.xml

This works great until I try and do it with a virtual directory. I get the following error:

ERROR ( message:Must use exact identifer for VDIR object with verb ADD. )

I have tried Googling this but can't find much. My goal is to be able to automatically deploy a site or service or collection of them to N number of machines via the CI server build process. Not sure why the vdir is acting differently than the others.

Here is the settings from the xml file for the vdir:

<appcmd>
    <VDIR physicalPath="C:\site\WebSite" path="/" APP.NAME="Default Web Site/myvdir" VDIR.NAME="Default Web Site/myvdir/">
        <virtualDirectory path="/" physicalPath="C:\site\WebSite" />
    </VDIR>
</appcmd>

Thanks

Was it helpful?

Solution

Your problem is occurring because you are trying to add a site with a file that only contains Virtual Directory Information. Try the command

appcmd add vdir /IN < fileWithSiteSettings.xml

and I think you will have better luck.

Presumably you are trying to add a virtual directory to an existing site, and thus the export of the VDIR only. Otherwise you should be exporting the entire site, and then loading it using your original command.

OTHER TIPS

I got ERROR ( message:Must use exact identifer for VDIR object with verb ADD. ) today, and solved it by adding a trailing / to the site name.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top