Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Stopping a service
Message
From
18/08/2010 15:02:55
 
 
To
18/08/2010 14:39:25
General information
Forum:
ASP.NET
Category:
Other
Environment versions
Environment:
VB 9.0
OS:
Windows 7
Network:
Windows 2003 Server
Database:
MS SQL Server
Application:
Web
Miscellaneous
Thread ID:
01477126
Message ID:
01477133
Views:
52
I tried this but it doesn't work:
    ' Stop the service
    Private Function StopService() As Boolean
        Dim loServiceController As System.ServiceProcess.ServiceController = New System.ServiceProcess.ServiceController()

        loServiceController.MachineName = "."
        loServiceController.ServiceName = "MyService"

        ' Stop the service
        loServiceController.Stop()

        Return True
    End Function
Basically, MachineName represents the PC itself. Then, ServiceName is the exact service name as defined in my project. However, the Stop() doesn't generate an error in the event viewer but the service still runs.
Michel Fournier
Level Extreme Inc.
Designer, architect, owner of the Level Extreme Platform
Subscribe to the site at https://www.levelextreme.com/Home/DataEntry?Activator=55&NoStore=303
Subscription benefits https://www.levelextreme.com/Home/ViewPage?Activator=7&ID=52
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform