Re-install Windows Service - Fail - windows-services

I developed a Windows Service project, then I installed.
Then I made some changes in the project, and tried to re-build, but it didn't apply the changes. So, I tried to uninstall and install again, but appears an error: "The service already exists". I try to delete, reboot, but I'm still unable to re-install the service (The same error is showed).
Does anybody know how to fix it?
And when I make changes in the project, I need only stop the service and build the project, that the changes are applied?
Thanks

If the Windows service is merely installed, you should be able to rebuild it without issue. Running it after a re-build will then pick up any changes you've made. However, if the service is running when you attempt to rebuild, you'll run into build issues because the assemblies are in use and cannot be changed. Thus, you have to stop the service first, rebuild, and then re-run the service.
As far as dealing with the install/uninstall issue, you should find everything you need to address the issue here.

Related

'daprd' is not recognized as an internal or external command, operable program or batch file

I am trying to debug a huge project using VS Code, the project is supposed to run on dapr using docker. I have installed dapr, docker, both seem to work fine. I also have VS Code, and I managed to get dapr extension for VS Code.
I build the project using dotnet build, no errors, so I am assuming that works fine, but when I try to debug it (run it) I get that error. I have read that it can be caused by having to set up environmental variables, but I don't know which environmental variables, as they seem to be present in the path (c:\users\myself.dapr\bin) is present.
So I have a few questions: what should I do now? and what is the reason behind it? Basically, I want to fix this, but knowing and understanding how, thanks.
As simple as restarting the laptop fix it, I guess that I did all of the installations without restarting and it needed a restart.
It was nothing to do with the environment variables in the end.

.Net Core application fails to publish to GCP App Engine becuase of MVC.Abstractions

This is my first foyer into .Net Core and App Engines, so please forgive me if I sound uninformed.
We have a .Net Core Application that we're trying to get published to a GCP App engine (obviously). when I run dotnet publish -c Release it builds just fine without any errors. When I test the program locally it runs just fine and I'm able to access it. However whenever I try to get it on GCP I get the following error:
Updating service [default] (this may take several minutes)...
.................................................................................................................................................failed.
ERROR: (gcloud.app.deploy) Error Response: [9]
Application startup error:
Error:
An assembly specified in the application dependencies manifest (ApplicationName.deps.json) was not found:
package: 'Microsoft.AspNetCore.Mvc.Abstractions', version: '2.0.2'
path: 'lib/netstandard2.0/Microsoft.AspNetCore.Mvc.Abstractions.dll'
This assembly was expected to be in the local runtime store as the application was published using the following target manifest files:
aspnetcore-store-2.0.5.xml
Failed to deploy project WebApiDotNetCore to App Engine Flex.
We tried removing it from the dependencies JSON, and that just ended up breaking everything, so it is indeed required. It is installed in the project via nuget, so it should be included with dotnet restore. I've looked around and some sources seem to think that it's the installation of the dotnet core sdk, but I've tried it on three computers and always get the same thing.
Lastly, I should say this happens when I try to deploy through command line as well as directly through Visual Studio with the GCP SDK.
Has anyone experienced this error, or something similar? Any advice or guidance is very much appreciated.
Thanks!
-BT
OP REVISION
As an update I was able to get this resolved aside from the fact that I get a 502 error when I try to load the application. Here are the steps I took for anyone else that is looking what to do:
Pre-reqs: Docker for Windows and Google Cloud SDK installed and running. Running turned out to be a pain with Docker for Windows. Many many restarts and reinstallations.
Open the solution and ensure that the startup project is set correctly.
Right click the startup Project, and select Add > Docker Support.
Select Linux in the popup window and allow the files to be created.
When complete, the Dockerfile should appear in the preview window. Do the following:
For me the first line read: FROM microsoft/aspnetcore:2.0 AS base. Change this to FROM microsoft/aspnetcore-build:2.0 AS base.
Additionally, check to make sure that the last line has the correct .dll name. Docker for Windows will put whatever the project name is rather than the class name, so for me my final .dll names were different than the project name.
Lastly, if your project has any dependencies that are required to run but not to build, then you'll need to manually add them. For me we have a couple of XML files that needed to be put in the app folder, so I had to add COPY *.xml /app/ and put those files in the same folder as the solution file is in.
If there's anything else you need to do to the Dockerfile I highly recommend this page. It's a how-to on all Dockerfile commands written in ENGLISH! (that was my biggest problem with all of this - I have little experience with Linux and even less with Docker and everything was written in Greek for me).
Create an app.yaml file. I just used the standard:
runtime: custom
env: flex
Copy the Dockerfile found in the startup project's folder into the folder with the solution.
Initialize gcloud to the right project, then navigate to the solution folder. The type gcloud app deploy app.yaml, and follow the onscreen guide.
for me it takes about 15 minutes to deploy the GCP, so depending on the complexity of your project it may take longer, though this one is rather complex.
Now I'm trying to figure out my 502 error... I've tried what seems like everything - changing the listening port in the application, exposing the listening port on the dockerfile, trying to get GCP to open that port, and trying half a dozen different ports. It's slow-going since it's such a chore to deploy each time.
Hope this helps anyone that was like me a couple weeks ago and had never even heard of Docker!
Which version of .NET Core is this? Also, have you tried to run in Cloud Shell? Maybe that will provide more clues on what might be wrong.
It looks that you don't have the Microsoft.AspNetCore.Mvc.Abstractions library installed in your system. Using the .NET CLI, type the following command:
dotnet add package Microsoft.AspNetCore.Mvc.Abstractions --version 2.0.2
After that, to ensure the library is included, run the following:
dotnet restore
dotnet build
Try running it locally (it should work), and then use the dotnet publish -c Release command again.

Upgrade (unisntall/install) Windows Service using InstallShield Setup Project

My question, is there a way to configure the InstallShield setup and deployment project so that when I attempt to install the service it will uninstall the previously installed version of the service.
I've created a Windows Service and an InstallShield setup and deployment project to be able to install it onto my machine. The process of installing and uninstalling the service all works fine. When I go to update the service, at the moment, I need to stop the service, uninstall the service manually, and then run the installer. What I am trying to get to is a point where I can run the installer and it will uninstall the previous version of the service before installing the current version.
I have seen this process of running the install and having the previous versions uninstalled work. Through creating a test project using a windows form application. I was able to install the application. Then I: incremented the product version, created a new product code, added a new upgrade entry in the upgrade path area, and configured that upgrade entry setting the min and max version. After doing this, I rebuilt the setup project and ran the installer and the upgrade from version A to version B was complete.
The only difference I believe from the original test project (where I saw the process work) and my Windows Service project is that my test project was a Windows Forms application versus a Windows Service. In all the research I have been doing I have seen people ask similar questions, but I have not seen any real suggestions on what actions to take. So if anyone knows if this is possible or has any suggestions that I could try to accomplish this task they would be greatly appreciated.
I was able to resolve this issue, so it is possible. The setting I mentioned above are the correct settings needed to allow the service to update. This was just a case of human error that was causing my problems.

Erlang machine stopped instantly (distribution name conflict?). The service is not restarted as OnFail is set to ignore

I am using RabbitMQ. For some reason the rabbitMQ service stops as soon as you start it. I saw following error in the event log:
RabbitMQ: Erlang machine stopped instantly (distribution name conflict?). The service is not restarted as OnFail is set to ignore.
Someone told me to run this command: erl -sname rabbit
This command generates following output:
{(no error logger present")i neirtr otre: r"mEirnraotri nign ipnr odcoe_sbso o<
t0".,2{.b0a>d awrigt,h[ {eexrilt_p rviaml_uleo:a d{ebra,dcahregc,k[_{feirlle__pr
reismu_llto,a3d,e[r{,fcihleec,k"_efrill_e_prreismu_llto,a3d,e[r{.feirlle",}\,"{e
lriln_ep,r29i3m}_]l}o,a{dienri.te,rgle\t"_}b,o{olti,n1e,,[2{9f3i}l]e},,"{iinniit
t.,egrelt"_}b,o{olti,n1e,,[78{9f}i]l}e,,{\i"niinti,tg.eetr_lb\o"o}t,,{2l,i[n{ef,
i7l8e9,}"]i}n,i{ti.neirtl,"g}e,t{_lbionoet,,7762},][}{,f{iilnei,t\,"dion_ibto.oe
tr,l3\,"[}{,f{illien,e",i77n6i}t].}e,r{li"n}i,t{,ldion_eb,o74o3t},]3},][}{}f
ile,\"init.erl\"},{line,743}]}]}\n"
I am not sure how to interpret this output. I wonder the error is specific to RabbitMQ or erlang.
I have no idea how to procceed. Please suggest.
I have just run into this problem setting up RabbitMq as a service up on a new Windows server. The only thing I can think of that broke it for me is renaming the new windows box after installing the RabbitMq service, but before testing it for the first time.
First off I noticed it ran as an application fine. I solved it by installing the service again using the command from the manual install instructions:
rabbitmq-service install
Assuming that you have your path variables included for the RabbitMq sbin directory.
The only thing that worked for me was to clear the directory C:\Users\xxxxx\AppData\Roaming\RabbitMQ.
(cf. https://groups.google.com/forum/#!topic/rabbitmq-users/138RHzzsORU)
In my scenario, Two directories of Erlang under C:\Program Files with different versions were there, I uninstalled one of the version, also uninstalled RabbitMQ service from Windows services list - Restarted the system.
Again ran RabbitMQ setup - RabbitMQ service was setup successfully.
I ran into the same issue when installing RabbitMQ 3.7.17 via Chocolatey on a Windows Server 2016.
After trying most of the suggested solutions, the one that worked for me was:
rabbitmq-service remove
rabbitmq-service install
rabbitmq-service start
PS: if your PATH is not configured for RabbitMQ, this is the folder you need to run the commands from: C:\Program Files\RabbitMQ Server\rabbitmq_server-3.7.17\sbin (if your version is also 3.7.17).
For anyone else looking up this error: double check your config files and SSL files. I ran into this issue when I had specified the ssl_options.cacertfile with ca.pem but the file was mistyped as ca-pem in the directory. Unfortunately RabbitMQ wasn't smart enough to catch the missing file and was dumping with no logs.
I found a name conflict with an env-variable, I use since years - means, this was not a problem with the previous version.
I have "Logs" and apps will write into that directory, usually with their own subdirectories. RMQ uses the same variable name and means a plain filename.
So using: "C:\Users\rabbit\AppData\Roaming\RabbitMQ\log\log" made it working for me - this is in the rabbit's users private environment. So the global settings are now not seen by rabbit. Uff. And it looks like, this is really meant as a filename and after I changed it again to "rabbit#c4711-node.log", it writes like the earlier version. The service starts now for me - but this was really messy and I don't trust it at the moment ;-)
From my perspective, one should run such a service under its own account. If the service is already there, create a local user account - I've used "rabbit" and give it a password. The account I created, got admin right from me - but I currently just dont know, it this is needed. At least it should not - will see this later. If you have account/credentials, go to the service manager and click properties for the service. On the second tab ("log on"), check "this account" and enter username an password. If you have an account for the service you should be able to login with user.
Then you can specify environment variables with user scope.
To do this, logon with the user you created. Go to ControlPanel/System and click "advanced":
In the Environment UI, enter user specific variables
in the top panel:
Note: This was not my rabbit user, because I currently cannot login there. The variables, I entered - not guaranteed, it is correct - are the following:
RABBITMQ_BASE=C:\Users\rabbit\AppData\Roaming\RabbitMQ
RABBITMQ_CONFIG_FILE=C:\Users\rabbit\AppData\Roaming\RabbitMQ\rabbitmq
RABBITMQ_LOGS=C:\Users\rabbit\AppData\Roaming\RabbitMQ\log
RABBITMQ_LOG_BASE=C:\Users\rabbit\AppData\Roaming\RabbitMQ\log
RABBITMQ_NODE_IP_ADDRESS=192.168.26.3
This works for me.
The last time I installed it - some years ago - it was better to understand - this time, sorry, I dont .....
But made it workig.
According to RabbitMQ Install on Windows guide here
Troubleshooting When Running as a Service
In the event that the Erlang VM crashes whilst RabbitMQ is running as
a service, rather than writing the crash dump to the current directory
(which doesn't make sense for a service) it is written to an
erl_crash.dump file in the base directory of the RabbitMQ server (set
by the RABBITMQ_BASE environment variable, defaulting to
%APPDATA%\%RABBITMQ_SERVICENAME% - typically %APPDATA%\RabbitMQ
otherwise).
Basically it means to add a Environment Variable named RABBITMQ_BASE with value %APPDATA%\RabbitMQ
This fixed my problem.
I ran into this issue and the only way I could solve it was by unintalling RabbitMQ, unsintalling Erlang, rebooting the server and installing a clean Erlang and a clean RabbitMQ.
After all this, I could finally install and start the RabbitMQ instance as a windows service.
Tried all the solutions in this post and nothing worked.
Lucky for me it was in our development server, so the loss was acceptable.
The downside to this approach is that you loose all configs (all users, virtual hosts, etc).
It's all gone and you have to reconfigure the RabbitMQ instance from scratch.
Checking in from 2021:
None of this worked for me, the problem was actually that I had another instance of RabbitMQ running inside my WSL Ubuntu distro.
I had the same issue and I just downloaded the latested version of erlang and RabbitmQ and this resolved the issue for me.
While I got the same error, and the root cause for me seems related to Erlang cookie, I fixed it by doing:
Create a folder to store cookie, for example I am using C:\erl-23.2\home .
Add new system environment variable HOMEDRIVE, set the value to C:\
Add new system environment variable HOMEPATH, set the value to erl-23.2\home
This is making use of the rule:
%HOMEDRIVE%%HOMEPATH%.erlang.cookie (usually C:\Users%USERNAME%.erlang.cookie for user %USERNAME%) if both the HOMEDRIVE and HOMEPATH environment variables are set
Since I was doing a migration when the error popped up, I still had my original .erlang.cookie in C:\Users\Me, but the new installation generated a new .erlang.cookie during installation in C:\Windows\System32\config\systemprofile. After making them equal again and performing these steps from the sbin dir, it worked again.
rabbitmq-service remove
rabbitmq-service install
rabbitmq-service start
I had this today trying to install rabbitmq 3.8.0 with erlang 22.0 (64Bit).
Even completely re-installing both erlang and rabbit, deleteing all directories and registry did not help at all. Also i tried to set the needed PATH variables for erlang manually and re-installing the service each time.
The only solution working for me was installing another version of erlang. In my sepcific case i used erlang 21.3 in the 32bit version.
Doing that, no manually action was necessary and rabbit was up and running (after re-installing the service).

MSI Installer fails during uninstall when serivce was already removed

I've an Installer with some custom actions & the designer fancy to install a windows service.
From times to times, when I made a mistake in my custom actions (or in the MSI configuration) the upgrade process may fail. Solution is to uninstall the Application and do a fresh installation.
But sometimes I'm ending in the situation, where I can't uninstall the Application because the "custom actions" for the service claims, that the service is not registered in the system. OK, maybe, no problem. I'm uninstalling the App. The problem: my app don't get uninstalled. It remains. I have to manually add the service to the registry again and restart the uninstall process.
Question: What do I have to configure/develop/program/etc. to tell the service (un)installer not to fail during uninstall when the service is already removed.
BTW: My custom actions do NOTHING during uninstallation. Only during installation/upgrade, I'm asking the user for some configuration and do some custom config stuff - only related to my app. Not related to the service.
EDIT: forgot to mention: VS 2008, default installer project, no fancy stuff, target machine is Windows XP
Yeah, that's one of the many reasons I say not to use VDPROJ and InstallUtil custom actions. You need to put a try catch block in your uninstall custom action and handle that scenario.
Hopefully you are testing on a VM and can just revert but in case this is your dev box use the Windows SC command to recreate the service so you can get the uninstall to work for now.
If you really want to do this right, you want to do something like this:
Augmenting InstallShield using Windows Installer XML - Windows Services
The same concept applies you'll just be adding the WiX merge module to your VDPROJ installer.

Resources