Windows服务,监控文件和日志 [英] Windows Service, Monitorize File and Log
本文介绍了Windows服务,监控文件和日志的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
大家好,这是一个问题:
我想创建一个Windows服务,它始终在运行并监视一个文件夹以获取新的传入文件(.xml)并创建一个日志,注册该信息并在每次出现新文件时运行一段代码。
希望你能帮助我,谢谢
Hi Everyone, here's a question:
I want to create a windows service, that is always running and monitorizes a folder for new incoming files (.xml) and create a log, registering that information and run a piece of code everytime that a new file appears.
Hope you can help me, thanks
推荐答案
相当完整:
http://devproconnections.com/net-framework/how-build-folder-watcher-service-c?page=3 [ ^ ]
使用vs
http://msdn.microsoft.com/en-us/library/zt39148a(v = VS.80)的.aspx [ ^ ]
由于您是c#的新手,我建议您将整个概念作为控制台应用程序开发。这将使您更容易调试和测试。一旦您满意,然后从模板创建一个服务并将测试的应用程序类移动到它。
Quite complete:
http://devproconnections.com/net-framework/how-build-folder-watcher-service-c?page=3[^]
To use vs
http://msdn.microsoft.com/en-us/library/zt39148a(v=vs.80).aspx[^]
As you are new to c# I would suggest you develop the whole concept as a console application. This will allow you to debug and test much easier. Once you are satisfied then create a service from the template and move your tested application classes to it.
这篇关于Windows服务,监控文件和日志的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文