Solved

Windows Service ServiceController in VB.NET error

Posted on 2011-03-03
3
1,386 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
3 Comments
 
LVL 11

Accepted Solution

by:
lenordiste earned 500 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

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

Question has a verified solution.

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

In my previous two articles we discussed Binary Serialization (http://www.experts-exchange.com/A_4362.html) and XML Serialization (http://www.experts-exchange.com/A_4425.html). In this article we will try to know more about SOAP (Simple Object Acces…
This article shows how to deploy dynamic backgrounds to computers depending on the aspect ratio of display
In this video we outline the Physical Segments view of NetCrunch network monitor. By following this brief how-to video, you will be able to learn how NetCrunch visualizes your network, how granular is the information collected, as well as where to f…
Do you want to know how to make a graph with Microsoft Access? First, create a query with the data for the chart. Then make a blank form and add a chart control. This video also shows how to change what data is displayed on the graph as well as form…

630 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