Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

Windows Service ServiceController in VB.NET error

Posted on 2011-03-03
3
Medium Priority
?
1,440 Views
Last Modified: 2012-08-14
I have created a windows service and have successfully installed it and confirmed it works.

Now I am trying to connect to it using a ServiceController from System.ServiceProcess.

I am not able to view information about my service, but I can view information from other services on the server... so I did not think it would be a network permission issue.

I get this error message:  "Cannot open DbaseEmailService service on computer 'ServerName'.
I get this InnerExeception Message:  "Access is denied"

I must have missed something when creating the service,  Is there some property I may need to set on my service app that will allow me to control it using the ServiceController in VB.NET?
Dim se As System.ServiceProcess.ServiceController

Try
             se = New System.ServiceProcess.ServiceController("DbaseEmailService", "ServerName") 'DOES NOT WORK
             
            ' se = New System.ServiceProcess.ServiceController("Alerter", "ServerName") 'WORKS OK


            ' se = New System.ServiceProcess.ServiceController("Dnscache", "ServerName") 'WORKS OK

        Dim bt As String = "Service Status Unknown"
        'display service status

        Select Case se.Status
            Case ServiceProcess.ServiceControllerStatus.Stopped
                bt = "Service Stopped"
                Case ServiceProcess.ServiceControllerStatus.Running
                    bt = "Service Running"
                Case Else

            End Select
            ButtonService.Content = bt

        Catch ex As Exception
            MessageBox.Show(ex.Message)
        End Try

Open in new window

0
Comment
Question by:handyjay
  • 2
3 Comments
 
LVL 11

Accepted Solution

by:
lenordiste earned 1500 total points
ID: 35032116
well, it does look like a permission issue. What account is your service running as ? is it the same as the other services you are able to query?

in any case you might want to look at this information:
http://craig.dubculture.co.nz/blog/2007/12/07/querying-the-status-of-a-windows-service/
0
 

Author Comment

by:handyjay
ID: 35036550
The service is running under account:  NT AUTHORITY\NetworkService

Everything else seems correct when comparing against other services that work.

The only difference was the Path to executable was different, so I made sure permissions were set the same as the others that work, but still have access denied.

0
 

Author Closing Comment

by:handyjay
ID: 35192225
Only answer I got... still not working
0

Featured Post

What is SQL Server and how does it work?

The purpose of this paper is to provide you background on SQL Server. It’s your self-study guide for learning fundamentals. It includes both the history of SQL and its technical basics. Concepts and definitions will form the solid foundation of your future DBA expertise.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Here I am going to explain creating proxies at runtime for WCF Service. So basically we use to generate proxies using Add Service Reference and then giving the Url of the WCF service then generate proxy files at client side. Ok, what if something ge…
If you need to start windows update installation remotely or as a scheduled task you will find this very helpful.
This course is ideal for IT System Administrators working with VMware vSphere and its associated products in their company infrastructure. This course teaches you how to install and maintain this virtualization technology to store data, prevent vuln…
Please read the paragraph below before following the instructions in the video — there are important caveats in the paragraph that I did not mention in the video. If your PaperPort 12 or PaperPort 14 is failing to start, or crashing, or hanging, …
Suggested Courses

916 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question