Cannot start Windows-worker service in mcr.microsoft.com/windows/servercore/insider:10.0.17763.107

Eric 1 Reputation point
2022-03-05T13:16:53.753+00:00

Hey, I have developed a Windows-worker service and I want to start it in a docker-based environment for automated testing. Therefore I build it with the following command:

dotnet publish -r win-x64 -c Release /p:PublishSingleFile=true

Additionally I have the following Dockerfile:

FROM mcr.microsoft.com/windows/servercore/insider:10.0.17763.107
COPY ["Install/", "C:/Service/Name/"]

RUN powershell New-Service -Name "Name" -BinaryPathName "C:\Service\Name\Name.exe"

When trying to start the service with Start-Service -Name "Name" the startup takes long and the service stays in the state Starting and then I get an 1053-error in the Eventlog (LogName=System).

Due to the fact, that the service did not start I made another one, that is mainly based on the template in Visual Studio, so it should only log a message to the eventlog. This service has the same behavior. When installing it on my local machine everything works fine.

Do you have any ideas why the service remains in the state Starting even though it does already the tasks of the Running-state?

.NET
.NET
Microsoft Technologies based on the .NET software framework.
3,346 questions
0 comments No comments
{count} votes