Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

706
Vistas
C# Application fails with "cannot start service from the command line" in docker but not on host

We have an in-house developed C# .NET application that we are trying to put in windows containers. The application was originally designed to run as a service but it seems to be that containers are better run as a process. So the devs have made some small changes and we can now run the application from the command line. It runs successfully on Win 10, 2012 R2, 2016, and 2019.

However, when trying to run the exact same application on a 2016 or 2019 container, we get the error message:

Cannot start service from the command line or a debugger. A Windows Service must first be installed (using installutil.exe) and then start with the ServerExplorer, Windows Services Administrative tool or the NET START command.

Why would running in a container change the way the application runs? There are no dependencies (other than .NET) for the application that are not included with the application.

I'm able to successfully install the application as a service in the container and start the service without errors. However trying to curl http://localhost in the container or outside the container fails even with the port is exposed via the -p 80:80 option from docker run.

I've seen previous versions of this application run successfully in a docker container as a process so I figure it has to be some caveat of C# but I'm not a dev and I'm getting a standard "it runs on the host, it must be a docker thing" answer from our devs.

over 4 years ago · Santiago Trujillo
1 Respuestas
Responde la pregunta

0

It turns out the code had an if statement on Environment.UserInteractive which told it whether to behave as console or service. In Windows Docker containers, the Environment.UserInteractive always triggers as false for some reason which forced the application to service even when run as a console. We used an environment variable to override the if.

Worth noting that apparently in .NET Core, the variable always triggers as true which may be helpful given the way Linux apps are usually triggered.

over 4 years ago · Santiago Trujillo Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda