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.
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.
Use the SC command.
sc \\remotecomputer create newservice binpath= C:\Windows\System32\Newserv.exe
start= auto obj= DOMAIN\username password= pwd
Related
When you install Windows Service via the wizard (using .msi file), Windows will add a record in Add or remove programs with a version number, that you can set in properties of the Wizard project.
You can also install Windows Service, using Sc.exe tool.
My question is, how to install windows service via Sc.exe tool and still have a record in Add or remove programs with a version. So I know what version of Windows Service is running. Ideal scenario would be to include the version in the code. So that Sc.exe will call MyService.exe without any parameters.
Thanks for help,
I wanted to start IIS Express with the configuration I wanted on boot. The best way to do this was the start it via a Service. I first tested it using a console application in VS 2013 (C#) by starting IIS Express as a process and killing it on exit. This worked fine.
However when I made it into a service, the service installed fine, and it started automatically but it refused to start IIS Express. I had to stop the service, go to the property of the service I installed and change the Log on option to “This account” enter my username and password, click OK, and start the service. This started the IIS Express and my webserver worked fine from that point onwards.
I have a two part question:
Is there something about IIS Express that I need to know which is stopping me from starting it from service?
What can I do to start it automatically either programmatically or during the Service installation process (serviceprocessinstaller properties perhaps)?
Thanks in advance :)
I inherited a couple c# windows service projects. I have fixed some bugs in the code and now I need to deploy the new executable. What is the normal process for updating / replacing a windows service? I have remote desktop access to the server that I am installing it on.
Just stop the service and replace the executable and possibli the additional dependency you have updated. Of course it could be helpful have a backup of the running service, just to be safe :)
If you need to know exactly where the service is running, open Service Control Manager, select your serice, and look in the properties/general: you will find the executable path.
It's enough to replace exe and dlls. Obviously you have to stop the service first. If dlls were registered in GAC they might be used by other software on that machine, in such case before compiling and deploying change their version.
For a .Net Windows Service you need to use the InstallUtil command line tool to uninstall the old service, then use it to install the new one.
See...
http://msdn.microsoft.com/en-us/library/50614e95(v=vs.80).aspx
I have simple C# console application developed in Visual Studio 2008, which writes information in MySQL database. Is it possible to run the application in my hosting environment (Cent OS, with local MySQL database)? I have only control panel or ftp access to my hosting space. The database is only accessible from local (from the hosting space).
I have read something about Mono/Monodevelop, but those need to be run on the Cent OS, right? I don't have access to install this or other staffs on the hosting environment.
Given what you've specified about the environment and your limitations, not you can't run it.
You will need to have Mono installed to run a .NET app on Linux. If you can't install it, you're probably out of luck.
You could check with your hosting provider to see if they have other options.
If your hosting provider allows it, has mono installed, and you've verified that your application runs under mono you may be able to invoke the program via a shell command from php.
<?php
$output = shell_exec('mono myprogram.exe');
echo "<pre>$output</pre>";
?>
If your host has mono installed, and you have the ability to execute arbitrary shell commands from PHP, then you can run it. Otherwise no. Do you have the source to the program? If so, I would just port the code to PHP (or whatever your host provides).
Scenario
I have a server, that has NO Visual Studio Installed. It literally has a normal command prompt and nothing installed yet. We don't want to install anything (except the .Net framework which we have already done). We just want to install a bunch of C# Windows Services that we have written.
So far
I have been installing and running the windows service on my local machine using a "setup and deploy" project that I built into the application, which I could then use to install the service locally.
Question
How can I install the service on the server?
I imagine it can be done from the command prompt only, but what else do I need? - If anything? and where do I put the files that I want to install BEFORE I install them?
I imagine I will have to compile the application on my local machine in Visual Studio, then copy it over to the server, and then run an install utility to install it on the server?
Any help would be greatly appreciated.
according to this thread you need to run
C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\InstallUtil.exe C:\MyService.exe
(replace c:\windows with your windows path)
Your server has a sc.exe (service control) command which allows you to install, uninstall, start, stop and configure services - no Visual Studio bits needed.
Run sc.exe -? at a command prompt to get a listing of all available options
I add code similar to the one in this article to my services:
http://www.codeproject.com/KB/dotnet/WinSvcSelfInstaller.aspx
Then I can install/uninstall them just by typing ServiceName -i or ServiceName -u at the command prompt. Makes it easier if it'll be installed by people who don't know .Net.