Solved

Windows Service ServiceController in VB.NET error

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

Master Your Team's Linux and Cloud Stack

Come see why top tech companies like Mailchimp and Media Temple use Linux Academy to build their employee training programs.

Question has a verified solution.

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

It’s quite interesting for me as I worked with Excel using vb.net for some time. Here are some topics which I know want to share with others whom this might help. First of all if you are working with Excel then you need to Download the Following …
Today I had a very interesting conundrum that had to get solved quickly. Needless to say, it wasn't resolved quickly because when we needed it we were very rushed, but as soon as the conference call was over and I took a step back I saw the correct …
The Email Laundry PDF encryption service allows companies to send confidential encrypted  emails to anybody. The PDF document can also contain attachments that are embedded in the encrypted PDF. The password is randomly generated by The Email Laundr…
In an interesting question (https://www.experts-exchange.com/questions/29008360/) here at Experts Exchange, a member asked how to split a single image into multiple images. The primary usage for this is to place many photographs on a flatbed scanner…

860 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