Results 1 to 2 of 2

Thread: [RESOLVED] [2005] verifying IIS from vb.net

  1. #1

    Thread Starter
    Fanatic Member vishalmarya's Avatar
    Join Date
    Feb 2001
    Location
    New Delhi , INDIA
    Posts
    858

    Resolved [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.
    Vishal Marya, MCP .net 3.5
    My Site
    http://www.vstoolsgallery.com/
    http://visualstudiogallery.msdn.micr...b-f87a909b9266





    Please indicate what version of vb you use.
    Please mark your thread resolved using the Thread Tools above.
    -----------------------------------------

  2. #2
    Smitten by reality Harsh Gupta's Avatar
    Join Date
    Feb 2005
    Posts
    2,938

    Re: [2005] verifying IIS from vb.net

    C# Code:
    1. System.ServiceProcess.ServiceController sc = new System.ServiceProcess.ServiceController("World Wide Web publishing");
    2.  
    3.             if (sc.Status == System.ServiceProcess.ServiceControllerStatus.Running)
    4.             {
    5.                 //Your code
    6.             }
    7.  
    8. // sc.Start() will start the service on the server
    Show Appreciation. Rate Posts.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width