Solved

How to start Windows Service before Desktop application

Posted on 2006-11-17
6
278 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
6 Comments
 
LVL 28

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

Free Trending Threat Insights Every Day

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

Join & Write a Comment

I previously wrote an article addressing the use of UBCD4WIN and SARDU. All are great, but I have always been an advocate of SARDU. Recently it was suggested that I go back and take a look at Easy2Boot in comparison.
If your app took Google’s lash recently, here are the 5 most likely reasons.
Using Adobe Premiere Pro, the viewer will learn how to set up a sequence with proper settings, importing pictures, rendering, and exporting the finished product.
XMind Plus helps organize all details/aspects of any project from large to small in an orderly and concise manner. If you are working on a complex project, use this micro tutorial to show you how to make a basic flow chart. The software is free when…

757 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

22 Experts available now in Live!

Get 1:1 Help Now