Solved

Windows Service ServiceController in VB.NET error

Posted on 2011-03-03
3
1,324 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 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

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

Suggested Solutions

This article describes relatively difficult and non-obvious issues that are likely to arise when creating COM class in Visual Studio and deploying it by professional MSI-authoring tools. It is assumed that the reader is already familiar with the cla…
Real-time is more about the business, not the technology. In day-to-day life, to make real-time decisions like buying or investing, business needs the latest information(e.g. Gold Rate/Stock Rate). Unlike traditional days, you need not wait for a fe…
This video explains how to create simple products associated to Magento configurable product and offers fast way of their generation with Store Manager for Magento tool.
You have products, that come in variants and want to set different prices for them? Watch this micro tutorial that describes how to configure prices for Magento super attributes. Assigning simple products to configurable: We assigned simple products…

707 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

Need Help in Real-Time?

Connect with top rated Experts

12 Experts available now in Live!

Get 1:1 Help Now