안녕하세요. 저는 Windows 서비스를 만들고 설치하는 것과 관련하여 온라인 자습서를 몇 번 따라 왔으며 계속 바인드에 들어간 것으로 보입니다. 나는 자습서 here을 따른다. 그리고 그것이 작동하고있는 것처럼 보인 동안, 그 100 %가 아니라.Windows 서비스 구현에 얽매임
이 SuperService가 시작 : 나는 다음과 같은 두 가지 이벤트를 보여줍니다 서비스를 시작한 후 이벤트 뷰어를 검사 할 때 지금
namespace SuperService { partial class Logger : ServiceBase { public Logger() { InitializeComponent(); } void timer1_Tick(object sender, EventArgs e) { LogEvent("This Timer has been ticked!", EventLogEntryType.Information); } protected override void OnStart(string[] args) { timer1.Tick += new EventHandler(timer1_Tick); timer1.Start(); LogEvent("This SuperService has started!", EventLogEntryType.Information); } protected override void OnStop() { LogEvent("This SuperService has stopped.", EventLogEntryType.Information); } protected override void OnPause() { base.OnPause(); timer1.Stop(); } protected override void OnContinue() { base.OnContinue(); timer1.Start(); } static void LogEvent(String Message, EventLogEntryType type) { String source = "Logger"; String log = "Application"; if (!EventLog.SourceExists(source)) { EventLog.CreateEventSource(source, log); } EventLog eLog = new EventLog(); eLog.Source = source; eLog.WriteEntry(Message, type); } } }
:이 사용하여 코드 메신저입니다!
서비스가 시작되었습니다.
그래서 나는 다소 잘 작동하지 않는 것 같습니다. timer1_Tick에 의해 트리거되는 이벤트는 보이지 않습니다. 누구나 왜 올바른 방향으로 나를 가리킬 수 있는지 알고 있습니까? 미리 감사드립니다.
타이머의 간격은 얼마입니까? 0이 아닌지 확인하십시오. –
타이머의 간격은 어디에 설정되어 있습니까? 어쩌면 디자이너일까요? 그리고 그 가치는 무엇입니까? –
은 60000이고 활성화 된 값은 –