2013-10-16 51 views
0

我安裝了一個窗口服務,窗口服務不執行的OnStart切入點

Some.WindowsService wService = new WindowsService(); 
Some.Server server = new Server(); 
Some.Service service = new Service(); 
Some.Request request = new Some.Request(msg, Id); 
var ReturnedResult = server.Execute(request); 

我檢查在服務中,「一些」在服務運行正常。 我不知道如何初始化,以便我可以在WindowsService中訪問受保護的OnStart()函數,以便它可以調用OnStart()函數中的函數。

任何想法都讚賞。非常感謝。 :)你可以測試這個

+0

你們是不是要調試的服務?還是不執行OnStart入口點?看看這個線程是否有幫助:http://stackoverflow.com/questions/19140045/start-windows-service-in-c-sharp/19141127#19141127 –

回答

1

一種方式是寫一個日誌文件或windows event log

System.Diagnostics.EventLog appLog = 
    new System.Diagnostics.EventLog() ; 
appLog.Source = "This Application's Name"; 
appLog.WriteEntry("An entry to the Application event log."); 
+0

謝謝。我使用了Debug - > Attach to Process – user2751691