0
這是我的主:Windows服務啓動失敗
static class Program
{
static void Main()
{
//Debugger.Launch();
ServiceBase[] ServicesToRun;
ServicesToRun = new ServiceBase[]
{
new Service1()
};
ServiceBase.Run(ServicesToRun);
}
}
這是我Service1()
代碼:
public partial class Service1 : ServiceBase
{
public Service1()
{
Thread messageThread = new Thread(new ThreadStart(Messaggi.Check));
messageThread.Start();
bool checkGruppoIndirizzi = true;
for (; ;)
{
SediOperative.Check();
Autisti.Check();
AutistiVeicoli.Check();
StatiVega.Check();
int res = Ordini.Check();
if (res == 0) AssegnazioniVega.Check();
Thread.Sleep(10000);
}
}
protected override void OnStart(string[] args)
{
}
protected override void OnStop()
{
}
}
的第一件事是,我不知道,如果以這種方式推出兩個線程是這是一個很好的事情,但真正的問題是程序在Visual Studio中運行良好,但安裝後(我使用InstallShield創建了一個安裝項目)我嘗試從Windows服務面板啓動我的服務,並得到:
Error 1053: The service did not respond to the start or control request in a timely fashion
謝謝我會試試這個解決方案重刑! – Federico