If I run the following command on my server:
%windir%\system32\inetsrv\AppCmd.exe list site
I get this output:
SITE "MyCompany.MyProject.WebRole_IN_0_Web" (id:1273337555,bindings:https/555.555.555.555:443:,state:Started)
How can I get just the site name:
MyCompany.MyProject.WebRole_IN_0_Web
Is some kind of nasty string parsing my only option? The server is a Windows Azure instance.
Got it:
Gives you this:
The help describes how this works:
I worked out that
name
was the correct attribute by calling:Which returns in XML format (including attribute names):
If you are looking to configure the site/application pool using an AppCmd startup task, check out my recent post about this:
http://mvolo.com/configure-iis-websites-windows-azure-startup-tasks-appcmd/
This covers how to find the site/application pool to edit, and also how to run the task AFTER the site/apppool configuration is created and not before.
Hope this helps.