How do I access remote IIS server by c# code. Like in I am in my local machine and I login to my remote server machine ABC001 where my .net application is deployed. Now how do I access that IIS(ABC001) from my local machine and Start/Stop the IIS through C# code.
string path = "IIS://{yourservername}/W3SVC"; using (DirectoryEntry w3svc = new DirectoryEntry(path)) { foreach (DirectoryEntry entry in w3svc.Children) { if (entry.SchemaClassName == "IIsWebServer") { string websiteName = (string)entry.Properties["ServerComment"].Value; } } }
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)