Solved

How to start Windows Service before Desktop application

Posted on 2006-11-17
6
283 Views
Last Modified: 2012-05-05
Hello all,
I am facing a problem please help me solve it.
I made a windows service and Desktop application.bacically my windows service monitor the application. Now problem arise here that I want to start my windows service first then want to start my Desktop application. Till now my service starts when my application starts. So please tell me the way how I can first start my windows service first then my Desktop application.
Regards
Pankaj
0
Comment
Question by:LioElectronic
[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
6 Comments
 
LVL 29

Accepted Solution

by:
Michael Pfister earned 500 total points
ID: 17964715
I don't know if that is what you want, but you can set any service to start "Automatic". It will then start when Windows starts.

Or you start your program via a batch script with 2 commands, i.e. name it Appstart.cmd

net start "Your service goes here"
"C:\Program Files\YourAppPath\YourApp.exe"

Hope it helps,

Michael




0
 
LVL 16

Expert Comment

by:Brian Pringle
ID: 17968123
You need to assign a user ID and password to the service.  

1. Right-click "My Computer".
2. Select "Manage"
3. Expand "Services and Applications"
4. Right-click your service in the right-hand pane and select "Properties"
5. On the "Log On" tab, select the radio button next to "This account".
6. Click "Browse" (don't type the name -- browsing ensures it is fully qualified)
7. Select a user account with privileges to run the service and click "OK".
8. Type the user account's password in the "Password" and "Confirm Password" text boxes.

Just to make sure it is continues to run if it encounters an occasional error...

9. Click the "Recovery" tab.
10. Select the "Restart the service" option in the "First failure" and "Second failure" drop-down lists.  Don't change "Subsequent failures".
11. Click "OK".

It should now run when Windows starts under the context of the user that is assigned to it.
0
 
LVL 3

Expert Comment

by:JRockSolid
ID: 17971754
I think you are asking How can you start your service before your app but at the same time start it with the app.

You could either
A) develop a small executable that fires your service and then if suucesful fire your app.  This way users wouldnt know it wasnt your app.

OR

B) If you dont mind just create a batch file to do the same thing

Rem Starting Service
sc Service name START
start <path>\<Filename of app>
0
 

Author Comment

by:LioElectronic
ID: 18155705
Oops...
I actually wanted to divide the points among all the answers. Please do the same
Regards
Amit
0

Featured Post

Industry Leaders: 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!

Question has a verified solution.

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

In our personal lives, we have well-designed consumer apps to delight us and make even the most complex transactions simple. Many enterprise applications, however, are a bit behind the times. For an enterprise app to be successful in today's tech wo…
This post contains step-by-step instructions for setting up alerting in Percona Monitoring and Management (PMM) using Grafana.
This video demonstrates how to use each tool, their shortcuts, where and when to use them, and how to use the keyboard to improve workflow.
Viewers will learn how to use the Hootsuite Dashboard.

630 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