How can I restart a IIS site by using appcmd commands?
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
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)