If I rebuild a Windows Service after making changes, can I just copy and replace the old assembly / .exe files to get those changes to run or do I need to re-install the service? Also do I have to first uninstall the service before installing the new version?
You don't have to uninstall and reinstall the service since this only adds registry info regarding the executable path and launch options. Just stop the service, copy your assemblies and restart it
You do not need to uninstall the service just make changes in your files after stopping the service and then start again it will consider your changes..
I would suggest you to use Topshelf for service hosting.
Related
i have had a problem with some self-programmed windows services for some time. The Windows services are built and installed by the Visual-Studio own setup project. Since some time there is a prompt after uninstalling these services that the system has to be restarted
see screenshot.
If you do not restart the system, install the new version of the service, this service will only run until the system is restarted. After restarting, the exe file is suddenly missing in the installation folder. So you are forced to restart Windows after uninstalling the service. Does anyone know why this happens?
Thanks for your help!
I have a windows service project in Visual Studio that I inherited from another developer, and I'm struggling to deploy the service to our server.
Is it possible to copy the build files from the Release folder to the server, and then run installutil on the exe?
I've tried it, and although the service install successfully, I'm getting an error 1053 when I start the service that
The service did not respond to the start or control request in a
timely fashion
Or is a setup project the only way to go?
If you just want to install a service some way other than an install utility, you can copy the output of the release folder of a windows service project to a directory and register the service using a Powershell command.
I have a 64-bit Windows Service, written in C#. It was previously installed on a Windows 7 64-bit machine. We've made some changes to it, and are trying to deploy the new version to the same machine.
However, no matter what we do, the behavior we are seeing seems to indicate that the service that is running is the old version.
Here are the steps we've taken in an attempt to resolve this issue:
Uninstalled the service using INSTALLUTIL.
Used SC DELETE to verify that it is removed.
Deleted all files from the service's installation directory, as specified in the service's properties page in the Services snap-in.
Removed any registry entries associated with the service from HKLM\System\CurrentControlSet001\Services.
Rebuilt the service and its dependencies with new version numbers.
Deployed the new version to the service's installation directory.
Reinstalled the service using INSTALLUTIL.
Verified that the Services snap-in and the registry are pointing to the correct location for the service executable.
Nonetheless, the behavior of the newly deployed service appears to be identical to the previous version. (Specifically, it is injecting messages into a queue in MSMQ, when that functionality was removed and can be verified to have been done so.)
We are positive that we are deploying the right version. This same behavior occurs even if we install the new version of the service from the Visual Studio project build folder (bin\x64\release).
Why is/would this be occurring? How do I resolve it? Are services cached somewhere and run from a cache when you install them? If so, where are they, and how do I properly clear them?
Or is this just something I've boned in the code?
I've created a Windows Service project in C#, just some very simple code. It worked when i installed the service, but now I have to add some code and so on,but that has caused some issues:
1) When trying to uninstall using "installutil /u" it says its removed however its still on the service list in computeradministration.
1a) I tried to delete it with cmd using "sc delete ServiceName" which removes it from the list
2) BUT when i install the new build it succeeds, however it still uses the old build for some reason, and im kindda at a loss.
You only have to install once. The service will be registered with the .exe you registered using sc or installutil.
To replace the binary, just stop the service, replace the binary with the "new" one and restart: the new service will be running.
Also, you have to restart services.msc to see that some services are removed (there seems to be some "pending removal" flag).
If your service is in use (e.g. it is running) when you uninstall it you may have to restart your computer after uninstalling it before it is completely uninstalled. installutil and sc does not give you any information about this. And when a service is pending removal you can get into all sorts of problems if you try to install it again (which seems to the problem that you experience).
Make sure that the service is stopped before uninstalling it to avoid having to restart your computer to complete the uninstall.
If you just want to update the binary of the service you can simply stop it and replace the executable files before restarting the service.
I have a process that is going to run as Windows Service.
I have successfully installed it as Windows Service and everything works.
My question is what are the guide lines for process directory.
On the machine Im going to deploy it, does the setup need to copy the .exe to Windows/System32 and then install as service ? Or i can deploy it to C:\MyApp\MyApp.exe and install as service from there.
It is not required for the .exe to be in /Windows/System32/ but is it "Best practice" ?
No. You shouldn't install anything to the Windows System folder. That's for operating system code.
You should install to your own application folder within the Program Files folder, and register as a Windows service thereafter.