In IIS7, you used to be able to use the Microsoft.Web.Administration
dll to manage IIS.
I have added this reference to my project, however running the following code results in a NotImplementedException
at site.Stop()
:
using (var server = new ServerManager())
{
var site = server.Sites.FirstOrDefault(s => s.Name == instanceName);
if (site != null)
{
site.Stop();
}
}
Is there an updated version of this API or an alternate method to manage IIS from .Net?
I would prefer not to use WMI or have to spawn an instance of appcmd
if at all possible.