Solved

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

Posted on 2007-11-15
8
3,002 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
[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
  • 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
Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
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

On Demand Webinar: Networking for the Cloud Era

Did you know SD-WANs can improve network connectivity? Check out this webinar to learn how an SD-WAN simplified, one-click tool can help you migrate and manage data in the cloud.

Question has a verified solution.

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

Since .Net 2.0, Visual Basic has made it easy to create a splash screen and set it via the "Splash Screen" drop down in the Project Properties.  A splash screen set in this manner is automatically created, displayed and closed by the framework itsel…
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 …
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…
This video Micro Tutorial shows how to password-protect PDF files with free software. Many software products can do this, such as Adobe Acrobat (but not Adobe Reader), Nuance PaperPort, and Nuance Power PDF, but they are not free products. This vide…

728 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