Windows Services: OnStart loop - do I need to delegate?

前端 未结 2 2013
失恋的感觉
失恋的感觉 2020-12-05 00:54

I\'ve got a windows service which scans a folder every n seconds for changes. I\'m getting \"the service did not respond to the start command in a timely fashion\" when tryi

2条回答
  •  我在风中等你
    2020-12-05 01:30

    The OnStart method shouldn't block. You need to spawn a worker thread that will do the job. You could also take a look at the FileSystemWatcher class to scan for file system change notifications.

提交回复
热议问题