John Zupancic
asked on
How to call windows service from windows application - (Vista issues) XP is ok
I wrote a windows service and a windows application in VS2005 in VB. The application monitors a folder for changes and calls the windows service if there are new files added to the folder. The windows service FTP's the files to an FTP server then shuts down and the application continues running.
The program works flawlessly on XP, but on Vista, the windows application fails to call the windows service. I'm using a ServiceController and in the code I have Me.ServiceController1.Star t(). I have error/success messages from the application and service writing to a custom event log I've created for this, but the only error message I'm getting is "Cannot open <service Name> on computer '.' " The properties for the ServiceController have the right ServiceName and have a single decimal for the MachineName since the service is local. How do I fix this so my application calls the service successfully? Since all I really want to do is call the windows service, is there a different way or a better to do what I'm looking for?
The program works flawlessly on XP, but on Vista, the windows application fails to call the windows service. I'm using a ServiceController and in the code I have Me.ServiceController1.Star
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
What account does the service run under?
Perhaps you need to install your application to run as that user also?
Perhaps you need to install your application to run as that user also?
ASKER
The service runs under the local system account. The installation package installs the application and the service for all users.
Does this help?
http://www.codeproject.com/vista-security/VistaSessions.asp
http://www.codeproject.com/vista-security/VistaSessions.asp
ASKER
It sounds promising, but I won't be able to look at it in more detail until later in the week. It'll also take me some time to convert it to VB.
This might help with the conversion part:
http://labs.developerfusion.co.uk/convert/csharp-to-vb.aspx
(it's not perfect, but it's quite useful for those times where you just aren't quite sure how to do something in the other language).
http://labs.developerfusion.co.uk/convert/csharp-to-vb.aspx
(it's not perfect, but it's quite useful for those times where you just aren't quite sure how to do something in the other language).
ASKER
I didn't want the user to have to do this and I haven't found a solution to this anywhere else, so I suppose I'll have to settle for Vista's new way of doing things. Thanks, I appreciate your help.
ASKER