This project has moved and is read-only. For the latest updates, please go here.

VDirList deployment on local machine

Topics: IIS and Web Services
Jan 26, 2010 at 8:17 PM

Today, removed some unused web methods, and added a SOAP/ASMX web service.  So just to make sure everything worked "clean", I deleted the virtual directories from IIS-7 and removed the physical directories from c:\inetpub\wwwroot.

My VDirs look like this:

    <VDirList Include="*">
    <VDirList Include="*">


When I did a local deploy with "Tools"/BTDF/"Deploy Biztalk Solution" I get the false errors.  I.e. it says the VDir already exists, when best I can tell it does not exist?

Is this possibly an IIS7 vs IIS6 issue?  IIS7 on the MSI installs have been smooth (I think we turned on the WMI compatiblity mode for IIS6).

When it says below that it "processed" the files, I'm not sure really what it did...

(Before and) After the deploy, there are no such directories in IIS at all.

  Virtual directory 'TFBIC.RCT.BizTalk.Orchestrations' already exists.
  Virtual directory 'TFBIC.RCT.BizTalk.Orchestrations_Proxy' already exists.

  processed dir: C:\Source\TFBIC.RCT.BizTalk\IISDirWCFPublishedOrchestrations
  processed dir: C:\Source\TFBIC.RCT.BizTalk\IISDirASMXPublishedOrchestrations
  processed dir: C:\Source\TFBIC.RCT.BizTalk\IISDirWCFPublishedOrchestrations\App_Data
  processed file: C:\Source\TFBIC.RCT.BizTalk\IISDirWCFPublishedOrchestrations\WcfService_TFBIC_RCT_BizTalk_Orchestrations.svc
  processed file: C:\Source\TFBIC.RCT.BizTalk\IISDirWCFPublishedOrchestrations\Web.config
  processed dir: C:\Source\TFBIC.RCT.BizTalk\IISDirASMXPublishedOrchestrations\App_Code
  processed dir: C:\Source\TFBIC.RCT.BizTalk\IISDirASMXPublishedOrchestrations\bin
  processed file: C:\Source\TFBIC.RCT.BizTalk\IISDirASMXPublishedOrchestrations\Global.asax
  processed file: C:\Source\TFBIC.RCT.BizTalk\IISDirASMXPublishedOrchestrations\Index.htm
  processed dir: C:\Source\TFBIC.RCT.BizTalk\IISDirASMXPublishedOrchestrations\temp
  processed file: C:\Source\TFBIC.RCT.BizTalk\IISDirASMXPublishedOrchestrations\TFBIC.RCT.BizTalk.Orchestrations.sln
  processed file: C:\Source\TFBIC.RCT.BizTalk\IISDirASMXPublishedOrchestrations\Web.config
  processed file: C:\Source\TFBIC.RCT.BizTalk\IISDirASMXPublishedOrchestrations\WebService_TFBIC_RCT_BizTalk_Orchestrations.asmx
  processed dir: C:\Source\TFBIC.RCT.BizTalk\IISDirASMXPublishedOrchestrations\xsd
  Connecting to server ...Done.
  Deleting extension file complete.
  Connecting to server ...Done.
  Adding extension file complete.
  Updating C:\Program Files (x86)\Microsoft BizTalk Server 2009\BTSNTSvc.exe.config...
  Adding/updating AppDomain configuration data for AppDomain 'TFBIC.RCT.BizTalk'...
  Saved updated BizTalk configuration file.



    Since I removed web methods, how do I clean those up in the target environments (QA, STAGE, PROD).  You don't delete the IIS directory on un-install, so I have to manually delete them I guess?   



Neal Walters


Jan 27, 2010 at 7:16 PM
Edited Feb 2, 2010 at 10:43 PM

The Framework currently uses the old IIS VBScript management scripts that came with IIS before 7.0 (and live as the IIS 6 compatibility tools in Vista/2008).  I'm not very clear if the 'already exists' above is happening to you on an IIS6 or 7 box.  I believe all of the 'processed' messages are NTFS permissions being applied to those files and folders.  Is it possible that the application has been removed but the vdir still exists, or maybe the vdir is also removed but the physical folder is still there?  I'd be interested to see what adsutil.vbs says about these vdirs if you run it from the command line w/ cscript or wscript.

EDIT 2/1/10 - Vdirs are deleted during undeployment only on server deployments.  AppPools are never deleted.


Jan 27, 2010 at 9:40 PM
Edited Jan 27, 2010 at 9:43 PM

I'm still getting used to IIS7. We have turned on the IIS6 compatibility.  My dev box is a Virtual Machine running Win2008 with IIS7. 

Here's the output of adsutil.vbs.  It seems to show some residual of those VDirs still on the system somewhere (even though I don't see any remnant of them in IIS7):

c:\inetpub\AdminScripts>cscript adsutil.vbs ENUM_ALL /P













The two lines in bold include what I thought were my "former" VDir names.

In IIS7 there is no right-click delete, but there is a "Remove" option.  When you click that, it seems to be the opposite of "Convert to Application".  It even asks you to confirm with this phrase: "Are you sure you want to remove the selected application".   After I clicked yes, I see just a normal folder there.  I then deleted that folder from the disk, and ran the above ADSUTIL.VBS.

I'm not sure where this vbs is getting all its data.  I looked at the code and see it's using an object model or WMI: 

Set IIsSchemaObject = GetObject(IIsSchemaPath)

Also note, I did an IISRESET, ran the adsutils.vbs again, and got same results. 

What's the difference between a VDir and an application?  I'm reading this blog now:

Also reading and about to try this: How to Delete a Virtual Directory in IIS7





Jan 27, 2010 at 9:59 PM
Edited Jan 27, 2010 at 10:27 PM


The technique of using the IIS GUI interface above didn't work at all - it didn't show any virtual directories.  However, the "appcmd" does, and can delete them...

c:\Windows\System32\inetsrv>appcmd vdir /?
Administration of virtual directories

APPCMD (command) VDIR <identifier> <-parameter1:value1 ...>

Supported commands:

  list      List virtual directories
  set       Configure virtual directory
  add       Add new virtual directory
  delete    Delete virtual directory

(To get help for each command use /?, e.g. 'appcmd.exe add site /?'.)

c:\Windows\System32\inetsrv>appcmd list vdir
VDIR "Default Web Site/" (physicalPath:%SystemDrive%\inetpub\wwwroot)
VDIR "Default Web Site/BAM/" (physicalPath:C:\Program Files (x86)\Microsoft BizT
alk Server 2009\BAMPortal)
VDIR "Default Web Site/BAM/BAMQueryService/" (physicalPath:C:\Program Files (x86
)\Microsoft BizTalk Server 2009\BAMPortal\BAMQueryService)
VDIR "Default Web Site/BAM/BAMManagementService/" (physicalPath:C:\Program Files
 (x86)\Microsoft BizTalk Server 2009\BAMPortal\BAMManagementService)
VDIR "Default Web Site/TFBIC.RCT.WCFWebServices/" (physicalPath:C:\Program Files
VDIR "Default Web Site/TFBIC.RCT.BizTalk.Orchestrations/" (physicalPath:C:\inetp


I'm trying to find the proper syntax to do a delete, so far trying these combinations and getting errors: 

c:\Windows\System32\inetsrv>appcmd delete vdir / Default Web Site/TFBI
Failed to process input: The parameter 'Web' must begin with a / or - (HRESULT=8

c:\Windows\System32\inetsrv>appcmd delete vdir / "Default Web Site"/TF
ERROR ( message:Must use exact identifer for VDIR object with verb DELETE. )

c:\Windows\System32\inetsrv>appcmd delete vdir / "Default Web Site/TFB
ERROR ( message:The attribute "" is not supported in the current comman
d usage. )

FINALLY copied from above:
c:\Windows\System32\inetsrv>appcmd delete vdir /"Default Web Site/TFBI
VDIR object "Default Web Site/TFBIC.RCT.BizTalk.Orchestrations/" deleted

Thought I had it beat, but went to run BTDF and got this:

  Virtual directory 'TFBIC.RCT.BizTalk.Orchestrations' already exists.
  Virtual directory 'TFBIC.RCT.BizTalk.Orchestrations_Proxy' already exists.


Still researching...

More girations - after the above, I had a Virtual Application, in IIS7 that when I clicked on it - was getting an object-reference exception.

Now, I seem to have everything look clear in "Appcmd", but adsutil.vbs still shows the _proxy exists. 

After above deploy, appcmd shows the Orchestrations deploy, but shows no sign of Orchestrations_proxy (one is WCF, the other is SOAP/asmx).  Unfortunately, we just found out that we had to deploy some orch's as SOAP to get them to work with Adobe Forms. 

c:\Windows\System32\inetsrv>appcmd list vdir
VDIR "Default Web Site/" (physicalPath:%SystemDrive%\inetpub\wwwroot)
VDIR "Default Web Site/BAM/" (physicalPath:C:\Program Files (x86)\Microsoft BizT
alk Server 2009\BAMPortal)
VDIR "Default Web Site/BAM/BAMQueryService/" (physicalPath:C:\Program Files (x86
)\Microsoft BizTalk Server 2009\BAMPortal\BAMQueryService)
VDIR "Default Web Site/BAM/BAMManagementService/" (physicalPath:C:\Program Files
 (x86)\Microsoft BizTalk Server 2009\BAMPortal\BAMManagementService)
VDIR "Default Web Site/TFBIC.RCT.WCFWebServices/" (physicalPath:C:\Program Files
VDIR "Default Web Site/TFBIC.RCT.BizTalk.Orchestrations/" (physicalPath:C:\Sourc

ADSUTIL shows:





These are directories that I deleted, and not sure why it is still showing them, and APPCMD is not.

Two Questions:

1) Are you using ADSUTILS.vbs to create the virtual directories?

2) Did I use the right command line on ADSUTILS above to list the virtual directories? 


Jan 28, 2010 at 5:05 AM

Applications are stacked on top of a vdir, basically enabling a script application like ASP or ASP.NET to run in the vdir.  Removing the application doesn't affect the vdir itself.

The Deployment Framework uses WMI in a custom MSBuild task to create the vdir.  It looks like you used the right command for adsutil.vbs, and it does indicate the existence of those vdirs.  It can also delete them.  I believe it has a /? help page.

When I have time, I plan to implement AppCmd.exe for IIS 7 management and the current method for IIS 6 and prior.


Jan 29, 2010 at 2:23 PM

I hope to get back to the above issue, but today is go-live day - so lots of things to do.  Looks like I'll be here one more week now. 

In doing a migration to our QA system last night, I encountered a similar problem (see below).  I deleted the IIS Applications, ran again, and got same error.  So I think the compatibility mode of IIS 7 is not really that compatible.  I'll continue to research how to delete using ADSUTILS, and I'll add an issue to please add IIS 7 "native" support.

            Target DeployVDirs:
                C:\Program Files (x86)\TFBIC.RCT.BizTalk\Deployment\Framework\BizTalkDeploymentFramework.targets(1319,5): error MSB4018: The "CreateVirtualDirectory" task failed unexpectedly.
                C:\Program Files (x86)\TFBIC.RCT.BizTalk\Deployment\Framework\BizTalkDeploymentFramework.targets(1319,5): error MSB4018: System.Runtime.InteropServices.COMException (0x800700B7): Cannot create a file when that file already exists. (Exception from HRESULT: 0x800700B7)
                C:\Program Files (x86)\TFBIC.RCT.BizTalk\Deployment\Framework\BizTalkDeploymentFramework.targets(1319,5): error MSB4018:    at System.DirectoryServices.Interop.UnsafeNativeMethods.IAdsContainer.Create(String className, String relativeName)
                C:\Program Files (x86)\TFBIC.RCT.BizTalk\Deployment\Framework\BizTalkDeploymentFramework.targets(1319,5): error MSB4018:    at System.DirectoryServices.DirectoryEntries.Add(String name, String schemaClassName)
                C:\Program Files (x86)\TFBIC.RCT.BizTalk\Deployment\Framework\BizTalkDeploymentFramework.targets(1319,5): error MSB4018:    at DeploymentFramework.BuildTasks.CreateVirtualDirectory.Execute()
                C:\Program Files (x86)\TFBIC.RCT.BizTalk\Deployment\Framework\BizTalkDeploymentFramework.targets(1319,5): error MSB4018:    at Microsoft.Build.BuildEngine.TaskEngine.ExecuteTask(ExecutionMode howToExecuteTask, Hashtable projectItemsAvailableToTask, BuildPropertyGroup projectPropertiesAvailableToTask, Boolean& taskClassWasFound)
            Done building target "DeployVDirs" in project "TFBIC.RCT.BizTalk.Deployment.btdfproj" -- FAILED.



Feb 1, 2010 at 4:04 PM

I still have more to research, but this morning, this is what I found.

1) When you run the "BizTalk WCF Publishing Wizard"  (or the SOAP "Web Service Publishing Wizard"), it creates a virtual application such as TFBIC.RCT.BizTalk.Orchestrations and apparently a Virtual Directory at c:\inetpub\wwwroot\TFBIC.RCT.BizTalk.Orchestrations. In IIS7 Manager, if you look at "Manage Application" then "Advanced Settings" the "Physical Path" will be: C:\inetpub\wwwroot\TFBIC.RCT.BizTalk.Orchestrations.

If you run ADSUTILS you can see that a VDIR exists:

c:\inetpub\AdminScripts>cscript adsutil.vbs ENUM /W3SVC/1/ROOT/TFBIC.RCT.BizTalk.Orchestrations

2) You copy that directory to your C:\source\project\IISVirtualDir and update your .btdfproj file

3) I believe that if you immediately do a deploy after this, you will get the first mentioned above "Virtual Directory already exists".  Despite this, the Deploy shows 0 errors. 

4) If you go to IIS7, click on the Virtual App, then click "Remove" the icon turns from an application to a folder, and data still resides in C:\inetpub\wwwroot\TFBIC.RCT.BizTalk.Orchestrations.  So you go to disk and delete that directory.  However, at this point, the VDIR still exists, and can be verified by again running ADSUTILS:

c:\inetpub\AdminScripts>cscript adsutil.vbs ENUM /W3SVC/1/ROOT/TFBIC.RCT.BizTalk.Orchestrations

This seems to be the command to delete the VDIR:

c:\inetpub\AdminScripts>cscript adsutil.vbs DELETE /W3SVC/1/ROOT/TFBIC.RCT.BizTalk.Orchestrations
Microsoft (R) Windows Script Host Version 5.7
Copyright (C) Microsoft Corporation. All rights reserved.

deleted path W3SVC/1/ROOT/TFBIC.RCT.BizTalk.Orchestrations"

5) Now, if you run the "Deploy" you will not get the "Virtual Directory already exists" message.

I'm trying to get an answer why you cannot view or see the VDIRs inside IIS7 Manager here:

I'm also still curious why deleting VDirs using AppCmd allows them to still appear in ADSUTIL.






Jun 24, 2010 at 5:27 PM
Need some help on Server site vDIR: 1. Can .btdfproj set the WebSite name for create virtual directory? Seems like the deployment framework put all the virtual directory under "Default Web Site" for Server deployment by default? 2. Can .btdfproj set the information of AppPool such as credential/login that using this pool (Predefined/other login)?
Jun 24, 2010 at 10:39 PM

1. No, currently it is hard-coded to use the default website.
2. No

Your best bet is probably to call out to appcmd.exe (Server 2008) or the IIS 6 admin VBScript files (< Server 2008) in a target named "CustomDeployTarget" in your .btdfproj.  That way you can get it configured just as you want.  The Deployment Framework's support for IIS goes way back (before I took over development) and is very basic.  It needs a complete overhaul, but that will have to wait for a future release.


Jun 29, 2010 at 12:30 AM

With the most recent build, you can now use a website other than the Default Web Site.  Just override the property IISMetabasePath.

Also, I was incorrect on #2...  You can do that.  If you look in the Advanced sample's InstallWizard.xml, you'll see that it captures a couple of properties VDIR_UserName and VDIR_UserPass.  Those together form the identity that will be assigned to the app pool specified in your VDirList item group.


Apr 18, 2011 at 4:53 PM

I'm having the same issue, and I assume this is systemic to developing on w2k8 in general?

Any other breakthroughs on this topic since the last post 10 months ago, or is the best workaround to run 'appcmd' to delete the offending vdir(s)?

Also, for IIS7+ you might consider using powershell as a more modern and build-script-friendly way of interacting with IIS (instead of appcmd?)

I don't recall if the powershell module for IIS admin is included as part of the IIS7 download or something unique to w2k8?

I have't used it much, but the WebAdministration module for powershell includes a juicy set of cmdlets:


Apr 18, 2011 at 6:15 PM

This fix worked for me:

It appears the deployment is setting "location" config elements, which are not removed when I removed the virtual directory using the IIS7 GUI.

On a hunch, I used the following (powershell) command to remove the offending location;

Remove-WebConfigurationLocation -PSPath 'MACHINE/WEBROOT/APPHOST' -Name 'Default Web Site/ProductActivation'

where 'ProductActivation' is the name of my vdir entry:

 <VDirList Include="*">
      <AppPool>ASP.NET v4.0</AppPool>

The DeployVDirs target succeeded after this change.

Apr 18, 2011 at 6:43 PM

I'm not sure what to make of this, because I haven't seen it happen.  Most of my dev work with the IIS deployment was on Vista, I think, but I don't remember seeing this on Server 2008 or Win7 either.  Did this fix that you're describing permanently take care of it, so that deploy/undeploy cycles always work fine afterward?  How did the vdir get created in the first place -- just by the BTDF deployment, and then the undeploy failed?


Apr 18, 2011 at 7:22 PM
Edited Apr 18, 2011 at 8:20 PM

(note: I am using Win2k8R2 for development, and it's IIS 7.5. I've also bolted on the WCF publishing task pasted earlier in the conversation)

Unexpectedly, removing that location via powershell seems to let me repeatedly deploy/undeploy. I'll be on the lookout if/when this resurfaces. I'll also try it on a few other similarly configured dev machines.

The vdir was created via BTDF deployment only.

Notable: even after undeploy, the iis 'location' remains (per Get-ConfigurationLocation), and a subsequent BTDF deployment says:

"Virtual directory 'ProductActivation' already exists. Reconfiguring existing vdir.
  Virtual directory 'ProductActivation' created/updated with path 'C:\s\EAI\ProductActivation\Deployment\IISVirtualDirectory'.
  Modifying NTFS permissions on virtual directory folders..."


Since it seems BTDF doesn't undeploy virtual directories (by design) as part of deployment, I guess the location being left around makes sense.

I originally focused on removing this location because it stood out as something referring to "ProductActivation" after I'd removed the ProductActivation application from the IIS7 management GUI.