Link to home
Start Free TrialLog in
Avatar of LioElectronic
LioElectronicFlag for Australia

asked on

How to start Windows Service before Desktop application

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
ASKER CERTIFIED SOLUTION
Avatar of Michael Pfister
Michael Pfister
Flag of Germany image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
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.
Avatar of JRockSolid
JRockSolid

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>
Avatar of LioElectronic

ASKER

Oops...
I actually wanted to divide the points among all the answers. Please do the same
Regards
Amit