Click here to Skip to main content
15,893,594 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hai
How to refresh specific service via vb in asp.net.i dont want stop and start or restart service.i will use following code for restart service.
VB
Private Sub startservice()
      Dim scServices() As ServiceController
      scServices = ServiceController.GetServices()

      Dim scTemp As ServiceController
      For Each scTemp In scServices
          If scTemp.ServiceName = "sample service name" Then
              Dim sc As New ServiceController("sample service name")
              Dim aa As String = sc.Status.ToString()
              If sc.Status = ServiceControllerStatus.Stopped Then
                  sc.Start()
                  While sc.Status = ServiceControllerStatus.Stopped
                      Thread.Sleep(5000)
                      sc.Refresh()
                  End While

              End If
          End If
      Next scTemp
  End Sub

the above code for used for restart service,so i use sc.Stop() and sc.Start().


Note:
i dont want above code for refersh service,like stop,start,restart.
i need refersh service via web.

if we open Services form Control Panel,we have 4 types of funtion for service
like if we select service and can click Stop,Start,Restart and refresh(semi green circle next to main menu )
The refersh one i need in vb code format. sc.Refersh() is correct ?

pls reply asap

regards
AravindB
Posted

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900