Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to install a C# Windows Service on a remote server?

Hi I have developed a C# Windows Service in Visual Studio. I am able to install this service on my local machine and it works fine. Now I want to be able to install it on a remote server.

Can you tell me how to do this?

My service is just built on the Windows Service VS template, so it's all very simple.

I am not so geeky, so it would be useful with some tutorial, manual which I can understand.

I am running VS 2010 Professional.

like image 387
Rune Hansen Avatar asked Jul 17 '13 12:07

Rune Hansen


People also ask

Can you install an air conditioner yourself?

While 87 percent of U.S. households use some type of air conditioning, central AC systems are the most sought-after for both convenience and accessibility. If flipping a switch for whole-house cooling is what you're after, you may wonder whether it's possible to install your own. And the answer is, you definitely can.

Can anyone install air conditioning?

Installing air conditioning in a house can be a tricky job if you're not a registered professional or an air conditioning engineer. You need to seek the help of an expert to install your home air conditioning units for you.


2 Answers

You need to have Remote Desktop access to the server.

When you are in you can do it via the commandline using something like this:

C:\Windows\Microsoft.NET\Framework\v2.0.50727\installutil /LogToConsole=true C:\Path\To\Service.exe

Then you can manage it (start it, set it to auto start, stop it, restart it) by going to Start | Run and typing

services.msc

then press enter.

To uninstall it use:

C:\Windows\Microsoft.NET\Framework\v2.0.50727\installutil /u /LogToConsole=true C:\Path\To\Service.exe

But you will need to have stopped the service first.

Note: There is probably a new util in newer .net releases - my notes are from a while ago when I built a 2.0 service. Look in C:\Windows\Microsoft.NET\Framework\ for a version number that matches the .net you're developing in.

like image 85
rtpHarry Avatar answered Sep 29 '22 22:09

rtpHarry


Use the SC command.

sc \\remotecomputer create newservice binpath= C:\Windows\System32\Newserv.exe 
   start= auto obj= DOMAIN\username password= pwd
like image 24
Akram Shahda Avatar answered Sep 29 '22 23:09

Akram Shahda