Solved

How to start Windows Service before Desktop application

Posted on 2006-11-17
6
280 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

Use Case: Protecting a Hybrid Cloud Infrastructure

Microsoft Azure is rapidly becoming the norm in dynamic IT environments. This document describes the challenges that organizations face when protecting data in a hybrid cloud IT environment and presents a use case to demonstrate how Acronis Backup protects all data.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
PDF to Word 25 156
Ransom.CRYPTXXX Activity 2 9 108
All doc, xls, and pdf's are gone 9 89
software license audit 6 67
Storage devices are generally used to save the data or sometime transfer the data from one computer system to another system. However, sometimes user accidentally erased their important data from the Storage devices. Users have to know how data reco…
A high-level exploration of how our ever-increasing access to information has changed the way we do our jobs.
The viewer will learn how to successfully create a multiboot device using the SARDU utility on Windows 7. Start the SARDU utility: Change the image directory to wherever you store your ISOs, this will prevent you from having 2 copies of an ISO wit…
With the power of JIRA, there's an unlimited number of ways you can customize it, use it and benefit from it. With that in mind, there's bound to be things that I wasn't able to cover in this course. With this summary we'll look at some places to go…

773 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