Problem after uninstalling service when asking for restart - WHY? - c#

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!

Related

VB.NET published windows app doesn't run

TOOLS:
Windows 10 Pro
Visual Studio 2017 Pro
I created a VB.NET windows app GUI on my desktop computer,
published it,
copied the publish\ directory to a new target laptop,
logged into laptop and ran publish > setup.exe
it asked me to "install" and I said YES,
and app started, but hung, never displaying the GUI.
My app has two .DLL's of mine, but they are not in the publish\ directory.
I made a HELLO WORLD on original desktop, published, and it ran ok at laptop.
All of your dlls need to be distributed with your application.
Try manually move your dlls in the same folder of .exe file on target machine: if it works simply rebuild your setup incuding these dlls as dependencies.
The problem is solved. The target laptop needed installation of drivers from a vendor of some 3rd party middleware used in the app.
So, the packaging software wasn't smart enough to tell me the problem, and its error correction response was to just end without any error message.

Unable to install new version of .NET Windows Service

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?

Do you need to re-install a Windows service after rebuilding

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.

Installing process as service directory decision

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.

Problems Installing a Windows Service from a Visual Studio Installer Project

The reason I ask is that I must be doing it incorrectly as I am having a lot of problems and I feel like I am chasing my tail here.
Using the how-to here, http://msdn.microsoft.com/en-us/library/zt39148a.aspx, and that works great.
So this windows service that I have built is a part of a solution that contains an ASP.NET MVC3 web UI, a class library business domain, and an installer for the windows service. Both the windows service and the MVC3 app reference the class library. I've marked only the Windows Service project as the "primary output" in the installer app.
Now, after a reboot, I can do build the installer and install the service and it runs great. However, after that first time, I have nothing but problems. In visual Studio, the uninstall option is grayed out, which is wrong, it should be active. I can uninstall in Windows but for some reason the process is still running. From there I cannot rebuild the installer project because the exe won't delete and is still running.
Where am I going wrong?

Categories

Resources