Solved

How to call windows service from windows application - (Vista issues) XP is ok

Posted on 2007-11-15
8
2,999 Views
Last Modified: 2010-04-21
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.Start().  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?
0
Comment
Question by:aperion
  • 4
  • 3
8 Comments
 
LVL 10

Accepted Solution

by:
ericwong27 earned 500 total points
ID: 20296492
It may due to insufficient user permissions. Maybe you can try following method
1. Locate the applications icon or short cut and Right click on it
2. From the Drop Down Menu select the Run As Administrator option

0
 
LVL 1

Author Comment

by:aperion
ID: 20296738
I can do that now, the problem is I don't want the user to have to do that everytime they want to run the program.  If I go in and click on Run As Admistrator, the program runs as expected.  But how do I configure the install package and/or the program to install with administrative priviledges so the user doesn't have to click on Run As Administrator everytime?
0
 
LVL 1

Expert Comment

by:adam_ingeniti
ID: 20318017
What account does the service run under?

Perhaps you need to install your application to run as that user also?
0
MS Dynamics Made Instantly Simpler

Make Your Microsoft Dynamics Investment Count  & Drastically Decrease Training Time by Providing Intuitive Step-By-Step WalkThru Tutorials.

 
LVL 1

Author Comment

by:aperion
ID: 20318037
The service runs under the local system account.  The installation package installs the application and the service for all users.
0
 
LVL 1

Expert Comment

by:adam_ingeniti
ID: 20318057
0
 
LVL 1

Author Comment

by:aperion
ID: 20318079
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.
0
 
LVL 1

Expert Comment

by:adam_ingeniti
ID: 20318093
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).
0
 
LVL 1

Author Closing Comment

by:aperion
ID: 31409501
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.
0

Featured Post

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Optimize the query 5 54
Passing data between Forms 3 28
VB.Net. Reading xml value 6 38
Huge BLOB data type in Oracle how to retrieve in vb.net and crystal reports 6 47
Well, all of us have seen the multiple EXCEL.EXE's in task manager that won't die even if you call the .close, .dispose methods. Try this method to kill any excels in memory. You can copy the kill function to create a check function and replace the …
Introduction As chip makers focus on adding processor cores over increasing clock speed, developers need to utilize the features of modern CPUs.  One of the ways we can do this is by implementing parallel algorithms in our software.   One recent…
The Task Scheduler is a powerful tool that is built into Windows. It allows you to schedule tasks (actions) on a recurring basis, such as hourly, daily, weekly, monthly, at log on, at startup, on idle, etc. This video Micro Tutorial is a brief intro…
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…

733 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