Beste, waar ik juist bij vast zit is het volgende dit is mijn code van mijn service in C#: using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Diagnostics; using System.ServiceProcess; using System.Text; using System.Windows.Forms; using SDTRfServer; namespace SDTRFServerService { public partial class Service1 : ServiceBase { public Service1() { InitializeComponent(); } protected override void OnStart(string[] args) { //EventLog.WriteEntry("Deze service is gestart !!"); SDTRfServer.frmStatus MyStat = new frmStatus(); MyStat.ShowDialog(); } protected override void OnStop() { // TODO: Add code here to perform any tear-down necessary to stop your service. } } Dus ik heb een tweede project in mijn omgeving geimporteerd en die form daarvan wil ik laten zien als mijn service is gestart op de computer. Fouten - Volgende fout als ik de service start in services.msc: The SrvService service on local computer started and then stoppen. Some services stop automatically if they are not in use by other services or programs[/quote] - Volgende in de application logs van windows (bij het starten van de service in services.msc): Service cannot be started. System.InvalidOperationException: Showing a modal dialog box or form when the application is not running in UserInteractive mode is not a valid operation. Specify the ServiceNotification or DefaultDesktopOnly style to display a notification from a service application. at System.Windows.Forms.Form.ShowDialog(IWin32Window owner) at System.Windows.Forms.Form.ShowDialog() at SDTRFServerService.Service1.OnStart(String[] args) in C:\Users\Niels Pauwels\Documents\Visual Studio 2005\Projects\SDTRFServerService\SDTRFServerService\Service1.cs:line 31 at System.ServiceProcess.ServiceBase.ServiceQueuedMainCallback(Object state)[/quote] Kan iemand helpen aub? 解决方案 这篇关于C#Sharp Windows服务的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持! 上岸,阿里云! 08-21 19:54