P
pvong
Trying to do this in VB.NET
All I want to do is restart a service called MxRtmSrvr. I tried this:
http://www.eggheadcafe.com/community/aspnet/14/10012971/start-and-stop-windows-se.aspx
This is my code page. For the line: Dim Controller as New Service
Controller, I'm getting the error message that "ServiceController" is not
defined. As you can see, I imported System.ServiceProcess.
Why am I getting this error message?
Also, I imported Threading. I want a 3 sec pause between stop and start.
Is Thread.Sleep(3000) the right way to do this?
Thanks!
-------------------------------------------------------
Imports System.Data, System.Data.SqlClient, System.Threading,
System.ServiceProcess
Partial Class Database
Inherits System.Web.UI.Page
Protected Sub MxRtmSrvrB_Click(ByVal sender As Object, ByVal e As
System.EventArgs) Handles MxRtmSrvrB.Click
Dim controller As New serviceController
controller.ServiceName = "MxRtmSrvr"
controller.Stop()
Thread.Sleep(3000)
controller.Start()
End Sub
End Class
All I want to do is restart a service called MxRtmSrvr. I tried this:
http://www.eggheadcafe.com/community/aspnet/14/10012971/start-and-stop-windows-se.aspx
This is my code page. For the line: Dim Controller as New Service
Controller, I'm getting the error message that "ServiceController" is not
defined. As you can see, I imported System.ServiceProcess.
Why am I getting this error message?
Also, I imported Threading. I want a 3 sec pause between stop and start.
Is Thread.Sleep(3000) the right way to do this?
Thanks!
-------------------------------------------------------
Imports System.Data, System.Data.SqlClient, System.Threading,
System.ServiceProcess
Partial Class Database
Inherits System.Web.UI.Page
Protected Sub MxRtmSrvrB_Click(ByVal sender As Object, ByVal e As
System.EventArgs) Handles MxRtmSrvrB.Click
Dim controller As New serviceController
controller.ServiceName = "MxRtmSrvr"
controller.Stop()
Thread.Sleep(3000)
controller.Start()
End Sub
End Class