Windows Service doesn't start automatically - windows-services

I have a windows service written in .Net 3.5 set to be automatically start, but it wouldn't start when system reboots.
As I understand, it may be caused by my service's dependency aren't started when the services tries to start. I don't know what my service depends on. I tried the workaround by adding windows print spooler as one of my service's dependencies, since print spooler is one of the services start quite late during the boot-up. Well, the work around doesn't work neither.
I'm using windows server 2003 r2. so the "delayed automatically restart" option is not available to me. and I can't use windows server 2008 just for this.
I'm out of ideas at the moment. Any suggestion would be appreciated.

A few suggestions to try out:
Check the system even logs
Add logging to your service, e.g. to system event log or use log4net
Strip the service down to a single message in the start-up or create a new stripped-down minimal service with as little dependencies as possible. See whether this starts
Check under which account your service is running and whether this account has the permission to "Run As A Service"

Related

How to solve the problem that docker cannot start on Intellij Utilmate on Windows 10 home? The docker service is on

I'm using Docker on Itellij ultimate on Windows 10 home, however I met this problem when using command docker ps. Can any one tell me how to solve this problem?
docker_engine: The system cannot find the file specified is a general connectivity error to the service. Most likely related to the desktop app not being running. So make sure it's in the tray icon up and running, otherwise restart it. Otherwise, check the firewall and antivirus for any block rules.

Disable Docker in Visual Studio

I have a Visual Studio Solution that I've been working with. This solution has a console app in it. Notably, I've been running Windows within a Bootcamp partition on my MacBook Pro.
A developer on my team wanted to use Docker. I agreed, thinking it wouldn't impact the console app itself. However, I can no longer compile the console app since Docker has been added. When I attempt to compile the solution, I see:
Visual Studio Container Tools requires Docker CE for Windows. To get it, see https://go.microsoft.com/fwlink/?linkid=847268
For more info, please see: http://aka.ms/DockerToolsTroubleshooting
Here's the problem, since I'm running Windows via a Bootcamp Partition, I can't run Docker (from my understanding). Is there a way to disable Docker just for my myself? If so, how? I don't want to undo what the other dev has done. However, I can't setup a brand new environment at this time.
My need is similar: disable Docker completely, but without uninstalling it.
So, this may help. But
My use case is different: I want to as nimbly as possible switch between VMWare and Docker.
My environment is different: I have a non-macbook PC and I'm only running Windows.
So YMMV.
This worked for my use case:
In the services control panel, disable the Docker for Windows Service or set it to manual start.
On the task manager startup tab, disable Docker for Windows.
For my use case only, there additional changes for VMWare. Disable DeviceGuard and CredentialsGuard per article at https://learn.microsoft.com/en-us/windows/security/identity-protection/credential-guard/credential-guard-manage.
Hope this helps for you.

Virtuoso Windows service not getting created

As per the instructions in virtuoso-t --help:
To create a windows service 'MyService' using the configuration file c:\database\virtuoso.ini:
virtuoso-t +service create +instance MyService +configfile c:\database\virtuoso.ini
I ran
virtuoso-t +service create +instance my-virtuoso +configfile D:\SOFT\Virtuoso\database\my-virtuoso.ini
got
[Using my-virtuoso.ini in D:\SOFT\Virtuoso\database]
The Virtuoso_my-virtuoso service has been registered
and is associated with the executable d:\soft\virtuoso\bin\virtuoso-t.exe
Service not showing in Windows services and not accessible on the port.
Is there a way to register a Virtuoso service on Windows 7?
BTW, OpenLink people (as I am pretty sure you are reading this), your instructions say To create a windows service 'MyService' but the result of the command run reports equivalent to Virtuoso_MyService. Might want to correct that in your next release, in addition to the actual service creation or maybe the instructions.
Thanks for the flag on the incorrect -? output. There are a few things that have changed and not been reflected properly there. That will be fixed.
One of these is that you should find the Service is listed in the control panel as OpenLink Virtuoso Server [MyService], which Windows knows as Virtuoso_MyService, and Virtuoso knows as MyService -- so the -? output should show --
To start this service in the command-line, use
sc start Virtuoso_MyService
or
virtuoso-t +service start +instance MyService
To work with this service in the Services or Component Services control panel, look for OpenLink Virtuoso Server [MyService].
Creating the Service does not start it; that's why it's not listening.
I have tested and confirmed all of the above on Windows 7, with both Open Source and Commercial Edition builds of version 7.2.4.2 (07.20.3217).

Launching a service from msi installer that depends on assemblies installed by the msi

I'm using WiX to write a MSI installer to start a service that depends on DLLs installed by the MSI. On Vista, the DLLs become added to the global assembly cache in the MSI's InstallFinalize phase, so I can't use the built-in service starting command in WiX. That one tries to start the service before the DLLs are in the GAC, and fails. The solution seems to be to use a custom action instead [1], and run that after InstallFinalize.
The custom action I used was starting the service with sc. Everything works fine when running the installer as an administrator, but running as a regular user doesn't work. The installer will elevate privileges for the actual install phase, but will drop them after finalizing the installation, and starting the service with sc as a non-privileged user will fail. Setting the custom action to be deferred and no-impersonate to get admin privileges won't work either after InstallFinalize [2].
As a final kludge, I tried to add <Condition>Privileged</Condition> to the WiX file to tell the user that the installer needs to be run as Administrator, but I couldn't get that to work either. The Privileged value gets set to 1 during the installation, maybe when the main install sequence is given higher privileges.
So has anyone else ran into the combination of Vista, non-Administrator user, installer needs to start a service and service needs stuff that goes into GAC during installation to run? Is there any kind of working general approach to this?
[1] http://www.mail-archive.com/wix-users#lists.sourceforge.net/msg09162.html
[2] http://www.mail-archive.com/wix-users#lists.sourceforge.net/msg15381.html
This is one of those times when the easiest solution is just to schedule a reboot.
Here are a few possibilities :
If possible, do not install prerequisite assemblies in the GAC. This will allow your service to be started normally (ie between InstallInitialize and InstallFinalize).
Create a bootstrapper (a small app that launches prerequisite MSIs in a certain order). Place the prerequisite assemblies (those that go in the GAC) into their own MSI, and get the bootstrapper to install them before it installs your service.
Create a launcher (an even smaller app that just launches your MSI). Give it a manifest that will make it run elevated. That way, the entire MSI is elevated, not just the part that's between InstallInitialize and InstallFinalize. You should be able to invoke sc succesfully.
I agree with #sascha. Rebooting is not just the easiest but cleanest in this case. All of the other proposed solutions are going to set you up for a much higher failure rate in the future. IMHO, the Windows Installer design w.r.t. the GAC is busted. The reboot is recognition of that.

Running an exe from windows service that interacts the the user's desktop

I've created a windows service in C# and Windows Server 2003. I would like my service to be able to run an exe file that is Windows forms application. When I start the service - it runs the other application but I cannot see it. When I open Task Manager - i can see that the application is running but I just cannot see it. I have checked "Allow the service to interact with the desktop" but nothing happens. Please help.
Is it possible to run and exe from within a windows service and see the exe running in widnows server 2003?
Showing UI from a Windows service is very problematic because the service may be running on a different desktop from the user (and on Vista/Server 2008 will in fact always run on a different desktop).
The easiest solution is to run the UI not directly from the service but from an application running on the user's desktop (maybe set to run at login) that communicate with the service somehow.
Just remember:
There may be no logged in user
There may be multiple logged in users using fast user switching or remote desktop
The application on the user desktop is running in the user's security context, not the service's

Resources