Solved

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

Posted on 2007-11-15
8
2,996 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
Comment Utility
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
Comment Utility
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
Comment Utility
What account does the service run under?

Perhaps you need to install your application to run as that user also?
0
 
LVL 1

Author Comment

by:aperion
Comment Utility
The service runs under the local system account.  The installation package installs the application and the service for all users.
0
How to improve team productivity

Quip adds documents, spreadsheets, and tasklists to your Slack experience
- Elevate ideas to Quip docs
- Share Quip docs in Slack
- Get notified of changes to your docs
- Available on iOS/Android/Desktop/Web
- Online/Offline

 
LVL 1

Expert Comment

by:adam_ingeniti
Comment Utility
0
 
LVL 1

Author Comment

by:aperion
Comment Utility
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
Comment Utility
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
Comment Utility
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

What Should I Do With This Threat Intelligence?

Are you wondering if you actually need threat intelligence? The answer is yes. We explain the basics for creating useful threat intelligence.

Join & Write a Comment

Article by: Kraeven
Introduction Remote Share is a simple remote sharing tool, enabling you to see, add and remove remote or local shares. The application is written in VB.NET targeting the .NET framework 2.0. The source code and the compiled programs have been in…
The ECB site provides FX rates for major currencies since its inception in 1999 in the form of an XML feed. The files have the following format (reducted for brevity) (CODE) There are three files available HERE (http://www.ecb.europa.eu/stats/exch…
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…
Polish reports in Access so they look terrific. Take yourself to another level. Equations, Back Color, Alternate Back Color. Write easy VBA Code. Tighten space to use less pages. Launch report from a menu, considering criteria only when it is filled…

762 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

9 Experts available now in Live!

Get 1:1 Help Now