Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

How to start Windows Service before Desktop application

Posted on 2006-11-17
6
Medium Priority
?
286 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 29

Accepted Solution

by:
Michael Pfister earned 1500 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

How to Use the Help Bell

Need to boost the visibility of your question for solutions? Use the Experts Exchange Help Bell to confirm priority levels and contact subject-matter experts for question attention.  Check out this how-to article for more information.

Question has a verified solution.

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

Web hosting control panels were first developed to make it faster and easier for most users to set up and operate websites. The graphical user interface (GUI) allows users to perform tasks by pointing and clicking rather than typing highly specific…
Steps to fix error: “Couldn’t mount the database that you specified. Specified database: HU-DB; Error code: An Active Manager operation fail”
Video by: Tony
This video teaches viewers how to export a project from Adobe Premiere Pro and the various file types involved.
In a question here at Experts Exchange (https://www.experts-exchange.com/questions/29062564/Adobe-acrobat-reader-DC.html), a member asked how to create a signature in Adobe Acrobat Reader DC (the free Reader product, not the paid, full Acrobat produ…

926 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