IIS

  • Thread starter Thread starter powerranger
  • Start date Start date
P

powerranger

I would like to know if there is a way to determine if IIS is up and
running at run time either thru webservice or window service. Thanks.
 
You could try making a request to a known website/file and see if an error
is returned.
 
Hi,

One way of checking whether IIS is running using the ServiceController
class. You can use the below code snippet to check if IIS is running...

ServiceController iis = new ServiceController("W3SVC");
if (iis.Status.ToString() == "Running")
{
Do Something
}

Hope this helps...

Regards,
Madhu

MVP - C# | MCSD.NET
 
Thanks for your reply, Madhu. Can I use your code to detect page cannot
be displayed error type?
 
Back
Top