Prev: Managing IIS7 programmatically from C++ (not .NET)
Next: AddHeader "Content-Length" does not work in IIS7
From: Patridge on 20 Jul 2010 11:07
I am trying to find a way to add a sub-application to an existing site via
appcmd command line.
I have tried to derive the syntax from various examples of modifying and
adding site bindings but the XML I need to generate doesn't quite fit with
those examples. I would like to result in the addition of the the following
XML to applicationHost.config under an existing site ("SomeSite" in the
example calls): "<application path="/subdir"><virtualDirectory path="/"
I have tried a number of variations on both "set config" and "add vdir" but
I cannot quite nail it down.
C:\>%windir%\System32\inetsrv\appcmd.exe set config "SomeSite"
==> "ERROR ( message:Cannot find requested collection element. )"
C:\>%windir%\System32\inetsrv\appcmd.exe add vdir /app.name:"SomeSite"
==> Creates a virtual directory on top of the sub-application directory in IIS
C:\>%windir%\System32\inetsrv\appcmd.exe add vdir
==> "ERROR ( message:Must use exact identifier for VDIR object with verb
If I could find a reference to the config syntax of brackets and periods,
especially regarding when to use a section name and when to use the attribute
breakdown, I would probably be able to work this out. Not finding such a
resource, though, I would appreciate any help I can get.
[Reposted for post-MSDN-account-linky goodness. Sorry for the duplicate.]
From: "WenJun Zhang[msft]" on 22 Jul 2010 23:29
To create web applications in IIS7, you should use: appcmd add app command.
The detailed description and sample can be found in below link:
Create a Web Application (IIS 7)
Microsoft Online Community Support
Delighting our customers is our #1 priority. We welcome your comments and
suggestions about how we can improve the support we provide to you.
Get notification to my posts through email? Please refer to
MSDN Managed Newsgroup support offering is for non-urgent issues where an
initial response from the community or a Microsoft Support Engineer within
2 business day is acceptable. Please note that each follow up response may
take approximately 2 business days as the support professional working with
you may need further investigation to reach the most efficient resolution.
The offering is not appropriate for situations that require urgent,
real-time or phone-based interactions. Issues of this nature are best
handled working with a dedicated Microsoft Support Engineer by contacting
Microsoft Customer Support Services (CSS) at
This posting is provided "AS IS" with no warranties, and confers no rights.
From: Patridge on 29 Jul 2010 18:11
This worked great. I just had to find the right syntax for this exact
operation and your link sent me to the right place.
%windir%\system32\inetsrv\appcmd add app /site.name:SomeSite /path:/subapp
Is there anywhere to go to get a better overview of the dots and brackets
syntax used in most of the "set config" calls (e.g., "/+[name='something']")?
""WenJun Zhang[msft]"" wrote:
> To create web applications in IIS7, you should use: appcmd add app command.
> The detailed description and sample can be found in below link:
> Create a Web Application (IIS 7)
> WenJun Zhang
> Microsoft Online Community Support