How to make a C Sharp 2010 application run as a service?

Posted on 2011-09-26
Last Modified: 2012-05-12
Hello everyone,
          I am kind of new in Microsoft technology and I need to put a C Sharp application to run as a service. This application has 9 different projects on it that run at the same time. All of them get call by the main thread or project.

After we finish testing, we need to put this application to run as a service and I need to know how to do this.
the OS is Windows Server 2008 R2 Standard
      64 bit Operating System

We have three servers, Principal, Mirror, and witness. I need to do this in both, Principal and Mirror.

Any link of a manual or tutorial will be useful.
Thank you
Question by:iscivanomar
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
  • 3
  • 3
LVL 12

Accepted Solution

serchlop earned 500 total points
ID: 36602269

Assisted Solution

iscivanomar earned 0 total points
ID: 36818554
I need to defined SQL Server Service as required to start first. How can I do this?

Ones I create the Service, how can I assign My C Sharp application to it?

Thank you.
LVL 12

Assisted Solution

serchlop earned 500 total points
ID: 36893137
This can also be done via command prompt using the sc command. The syntax is:

sc config [service name] depend= <Dependencies(separated by / (forward slash))>

Note: There is a space after the equals sign, and there is not one before it. So if you want ServiceA to depend on both ServiceB and ServiceC--that is to say, ServiceA will not start until the other two have started--then you would use this:

sc config ServiceA depend= ServiceB/ServiceC

Edit: Also, if you want to remove all dependencies, you have to use the following syntax:

sc config ServiceA depend= /

Resolve Critical IT Incidents Fast

If your data, services or processes become compromised, your organization can suffer damage in just minutes and how fast you communicate during a major IT incident is everything. Learn how to immediately identify incidents & best practices to resolve them quickly and effectively.

LVL 12

Assisted Solution

serchlop earned 500 total points
ID: 36893138

Author Comment

ID: 36927969
Thank you for you comments, I am going to try this tomorrow and I will let you know how it went.

Thank you.

Author Closing Comment

ID: 37068297
Thank you serchlop for all your useful information. I did not know anything about this but now, I know what I am doing.

Have a good day.

Featured Post

Independent Software Vendors: 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

You might have come across a situation when you have Exchange 2013 server in two different sites (Production and DR). After adding the Database copy in ECP console it displays Database copy status unknown for the DR exchange server. Issue is strange…
Performance in games development is paramount: every microsecond counts to be able to do everything in less than 33ms (aiming at 16ms). C# foreach statement is one of the worst performance killers, and here I explain why.
To efficiently enable the rotation of USB drives for backups, storage pools need to be created. This way no matter which USB drive is installed, the backups will successfully write without any administrative intervention. Multiple USB devices need t…
This tutorial will walk an individual through the process of transferring the five major, necessary Active Directory Roles, commonly referred to as the FSMO roles to another domain controller. Log onto the new domain controller with a user account t…

697 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