-3
我創建文件記錄,但現在服務無法運行不能被Windows服務中創建的文件在我的窗口服務
Logger.InitLogFile("BridgeServiceLog.txt");
給我這個錯誤錯誤1053:服務沒有啓動或控制響應要求及時
public BridgeService()
{
InitializeComponent();
Logger.InitLogFile("BridgeServiceLog.txt");
Trace.WriteLine(Logger.logSwitch.TraceInfo, "Trace Started");
this.ServiceName = "BridgeService";
if (!System.Diagnostics.EventLog.SourceExists("BridgeSource"))
{
System.Diagnostics.EventLog.CreateEventSource("BridgeSource", "BridgeLog");
}
_bridgeServiceEventLog.Source = "BridgeSource";
_bridgeServiceEventLog.Log = "BridgeLog";
}
我OnStart方法
protected override void OnStart(string[] args)
{
Trace.WriteLineIf(Logger.logSwitch.TraceInfo, "OnStart method Started");
try
{
_bridgeServiceEventLog.WriteEntry("new OnStart");
if (Vytru.Platform.Bridge.Configuration.LicenseValidetor.ValidCountAndTypeDevices())
{
SharedData.InitializeBridge();
// WsInitializeBridge();
}
else
{
this.Stop();
_bridgeServiceEventLog.WriteEntry("LicenseValidetor Error");
}
_bridgeServiceEventLog.WriteEntry("end Start");
}
catch (Exception e)
{
Trace.WriteLineIf(Logger.logSwitch.TraceError, e.Message);
_bridgeServiceEventLog.WriteEntry("error In onstart method " + e.Message);
}
Trace.WriteLineIf(Logger.logSwitch.TraceInfo, "OnStart Ended");
}
錯誤?例外? –
它爲什麼不運行?它會給出錯誤嗎?什麼是'SharedData.APPLICATION_LOCAL_PATH'? –
你可以發佈你的'開始'功能嗎? – Default