Service is being created with executable path pointing to DLL instead of EXE
Nadie ha tomado este issue todavía.
Evaluación
- Dificultad
- 4/5
- Tiempo estimado
- 3-5 días
- Aptitud para principiantes
- 25/100
- Tipo de issue
- Error
- Claridad
- Bastante claro
- Estado de actividad
- Estancado
- Stack tecnológico
- csharp
- Área
- operating-systems, tooling
Línea de trabajo
Comienza con ManagedInstallerClass.InstallHelper y la configuración de ServiceInstaller mostrada en el issue; después reproduce la instalación de .NET 6 usando Assembly.GetExecutingAssembly().Location y Environment.ProcessPath. Traza cómo la biblioteca deriva la ruta del binario del servicio y verifica la corrección instalándolo correctamente con el servicio configurado para iniciar el ejecutable previsto.
Escrito por el modelo de indexación a partir del texto del issue.
Descripción
We have a service installation code which works just fine with .NET Frameworks 4.8 Console application based on ServiceBase:
ManagedInstallerClass.InstallHelper(new string[] { Assembly.GetExecutingAssembly().Location });
using System.ComponentModel;
using System.Configuration.Install;
using System.ServiceProcess;
namespace TestServiceInstall
{
[RunInstaller(true)]
public class TestServiceInstaller : Installer
{
public TestServiceInstaller()
{
ServiceProcessInstaller processInstaller = new ServiceProcessInstaller();
ServiceInstaller serviceInstaller = new ServiceInstaller();
// set the privileges
processInstaller.Account = ServiceAccount.LocalSystem;
serviceInstaller.DisplayName = GlobalVar.SERVICE_NAME;
serviceInstaller.StartType = ServiceStartMode.Automatic;
serviceInstaller.DelayedAutoStart = true;
serviceInstaller.ServicesDependedOn = new string[] { "Tcpip" };
// must be the same as what was set in Program's constructor
serviceInstaller.ServiceName = GlobalVar.SERVICE_NAME;
// installer code here
this.AfterInstall += new InstallEventHandler(ServiceInstaller_AfterInstall);
this.Installers.Add(processInstaller);
this.Installers.Add(serviceInstaller);
}
void ServiceInstaller_AfterInstall(object sender, InstallEventArgs e)
{
ServiceController sc = new ServiceController(GlobalVar.SERVICE_NAME);
sc.Start();
}
}
}
We tried to migrate to .NET 6.0 and use this library to install the service in a same way we used to, but what happens is service binary path changed from EXE file to DLL file and we can't figure out how to point it to the EXE file.
We've tried changing Assembly.GetExecutingAssembly().Location to Environment.ProcessPath but it gives us the following error:
System.BadImageFormatException: Bad IL format. The format of the file '%EXE path here%' is invalid..
So the question is how can we use this library to install a windows service pointing to EXE file instead of DLL?
- Lenguaje dominante
- C#
- Estrellas
- 26
- Forks
- 12
- Métricas de merge de PR
- Sin PR fusionados en 30 d
Guía de contribución
No hay ninguna guía de contribución indexada para este repositorio
Primeros pasos
- Lee el issue completo y luego la guía de contribución del proyecto.
- Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
- Haz un fork del repositorio y trabaja en una rama.
- Abre un pull request que haga referencia al número del issue.
Más de flamencist/Core.System.Configuration.Install
-
Dificultad 3/5 1-2 días Aptitud para principiantes 35/100
-
Dificultad 4/5 3-5 días Aptitud para principiantes 25/100
-
Dificultad 4/5 3-5 días Aptitud para principiantes 30/100
flamencist/Core.System.Configuration.Install#11 · 2 reacciones ·
-
Dificultad 4/5 3-5 días Aptitud para principiantes 20/100
flamencist/Core.System.Configuration.Install#9 · 1 comentario ·
-
Dificultad 5/5 Más de una semana Aptitud para principiantes 25/100
flamencist/Core.System.Configuration.Install#1 · 3 comentarios · 1 reacción ·
Todos los issues de flamencist/Core.System.Configuration.Install
Issues similares
-
effort:S P3 refactor
Dificultad 2/5 1-3 horas Aptitud para principiantes 75/100
nightscout/nocturne#1532 ·
-
core dependencies
Dificultad 1/5 Menos de una hora Aptitud para principiantes 80/100
-
documentation
Dificultad 2/5 1-3 horas Aptitud para principiantes 75/100
-
C#/.NET Roslyn LSP Abierto
Dificultad 2/5 1-3 horas Aptitud para principiantes 70/100
-
Suspicious code fragments Abierto
Dificultad 2/5 1-3 horas Aptitud para principiantes 75/100
DotNetNext/SqlSugar#1458 ·