7

I'm wondering the possibility of restart a site in the IIS 7.5 via appcmd commands. To list the all sites available I got success by using:

appcmd.exe list site

2 Answers2

11

You have a couple of options here:

To restart an individual app pool, try (Reference):

appcmd recycle apppool /apppool.name:string

OR

 appcmd stop apppool /apppool.name:Marketing 
 appcmd start apppool /apppool.name:Marketing 

To restart an individual website, try (Reference)

 appcmd stop site /site.name:contoso 
 appcmd start site /site.name:contoso

or you could restart the whole IIS server:

iisreset

I think this works on IIS 7.5 It definitely does on 7.0 and I've been informed by a colleague that it does on 8, so no reason to believe 7.5 won't

Hope this helps

Walter Stabosz
  • 223
  • 1
  • 3
  • 10
Fazer87
  • 515
  • 2
    by using your penultimate option, I got an error when tryed to run this line replacing the "contoso" string with "my_real_site_name.com" where says: The attribute "site.name" is not supported in the current command usage. Am I using the command in a wrong way? – Developer Ph2 Apr 24 '15 at 17:29
  • Fazer 87, as you can see below, I found my answer based on your above, therefore, I'll mark as the accepted answer! I also would like to give you a up vote due the useful extra commands, however, I haven't points enough to do that. Sorry =/ – Developer Ph2 Apr 24 '15 at 18:20
  • Thanks for the accolade :) As long as you're sorted and workng :) – Fazer87 Apr 27 '15 at 09:10
  • The solution works, but there shoudn't be any spaces between "/site.name: contoso" for it to work. – Oscar Feb 04 '19 at 10:34
1

Ok, I was able to get it working on IIS 7.5 by changing the following details in the @Fazer87's command:

Instead:

appcmd start site /site.name: contoso

Change to:

appcmd start site "my_real_site_name.com" (also note the double quotes)