Service is being created with executable path pointing to DLL instead of EXE
Nessuno ha ancora preso questa issue.
Valutazione
- Difficoltà
- 4/5
- Tempo stimato
- 3-5 giorni
- Idoneità per principianti
- 25/100
- Tipo di issue
- Bug
- Chiarezza
- Abbastanza chiara
- Stato di attività
- Ferma
- Stack tecnologico
- csharp
- Ambito
- operating-systems, tooling
Direzione di ricerca
Inizia con ManagedInstallerClass.InstallHelper e la configurazione di ServiceInstaller mostrata nell’issue, quindi riproduci l’installazione di .NET 6 usando Assembly.GetExecutingAssembly().Location e Environment.ProcessPath. Traccia il modo in cui la libreria ricava il percorso del binario del servizio e verifica la correzione installandolo correttamente, con il servizio configurato per avviare l’eseguibile previsto.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
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?
- Lingua principale
- C#
- Stelle
- 26
- Fork
- 12
- Metriche di merge delle PR
- Nessuna PR unita negli ultimi 30g
Guida per i contributori
Nessuna guida per i contributori indicizzata per questo repository
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Altre issue di flamencist/Core.System.Configuration.Install
-
Difficoltà 3/5 1-2 giorni Idoneità per principianti 35/100
-
Difficoltà 4/5 3-5 giorni Idoneità per principianti 25/100
-
Difficoltà 4/5 3-5 giorni Idoneità per principianti 30/100
flamencist/Core.System.Configuration.Install#11 · 2 reazioni ·
-
Difficoltà 4/5 3-5 giorni Idoneità per principianti 20/100
flamencist/Core.System.Configuration.Install#9 · 1 commento ·
-
Difficoltà 5/5 Più di una settimana Idoneità per principianti 25/100
flamencist/Core.System.Configuration.Install#1 · 3 commenti · 1 reazione ·
Tutte le issue di flamencist/Core.System.Configuration.Install
Issue simili
-
type/automation type/tech-debt
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
-
bug
Difficoltà 2/5 1-3 ore Idoneità per principianti 88/100
-
t/bug
Difficoltà 2/5 1-3 ore Idoneità per principianti 82/100
-
ci-failure-cause test-failure
Difficoltà 2/5 1-3 ore Idoneità per principianti 82/100
-
area:auth FE mvp P3
Difficoltà 2/5 1-3 ore Idoneità per principianti 88/100
klasolsson81/jobbliggaren#1788 ·