[RESOLVED] [2005] verifying IIS from vb.net
using vb.net (.net 2.0) , how to verify if IIS is running ?
if i use :
"iisreset /status" at command line ( or through vb.net )
the following text is displayed.
Status for World Wide Web Publishing ( W3SVC ) : Running
Status for Simple Mail Transfer Protocol (SMTP) ( SMTPSVC ) : Running
Status for FTP Publishing ( MSFtpsvc ) : Running
I could redirect the command output to a file and read the file for the above mentioned text to verify the status, but is there a better way.
the above text is displayed from iis 5.1 , suppose iis 6 or 7 displays something else.
Re: [2005] verifying IIS from vb.net
C# Code:
System.ServiceProcess.ServiceController sc = new System.ServiceProcess.ServiceController("World Wide Web publishing");
if (sc.Status == System.ServiceProcess.ServiceControllerStatus.Running)
{
//Your code
}
// sc.Start() will start the service on the server