From: Patridge on
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="/"
physicalPath="{locationOfSubSite}\subdir" /></application>".

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"
/section:system.applicationHost/sites
/+"[name='SomeSite'].[path='/subapp'].[path='/',physicalPath='D:\inetpub\wwwroot\SomeSite\SubApplication']" /commitPath:apphost
==> "ERROR ( message:Cannot find requested collection element. )"

C:\>%windir%\System32\inetsrv\appcmd.exe add vdir /app.name:"SomeSite"
/path:"/subapp" /physicalPath:"D:\inetpub\wwwroot\SomeSite\SubApplication"
/commitPath:apphost
==> Creates a virtual directory on top of the sub-application directory in IIS

C:\>%windir%\System32\inetsrv\appcmd.exe add vdir
/app.name:"SomeSite/subapp" /path:"/"
/physicalPath:"D:\inetpub\wwwroot\SomeSite\SubApplication" /commitPath:apphost
==> "ERROR ( message:Must use exact identifier for VDIR object with verb
ADD. )"

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
Hi,

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)
http://technet.microsoft.com/en-us/library/cc772042(WS.10).aspx

Thanks.

Sincerely,

WenJun Zhang

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
http://msdn.microsoft.com/en-us/subscriptions/aa948868.aspx#notifications.

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
http://msdn.microsoft.com/en-us/subscriptions/aa948874.aspx
==================================================
This posting is provided "AS IS" with no warranties, and confers no rights.

From: Patridge on
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
/physicalPath:D:\inetpub\wwwroot\SomeSite\SubApplication

Thanks again.

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:

> Hi,
>
> 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)
> http://technet.microsoft.com/en-us/library/cc772042(WS.10).aspx
>
> Thanks.
>
> Sincerely,
>
> WenJun Zhang
>
> Microsoft Online Community Support