配置一个xml其中有是否开启监视、监视时间、监视路径。

      FileSystemWatcher watcherName = new FileSystemWatcher();
            watcherName.IncludeSubdirectories = false;
            watcherName.Filter = "*.txt";
            watcherName.Path = ulrValue + @"\";
            watcherName.Created += new FileSystemEventHandler(watcherName_Created);//新增事件
       //
watcherName存在 删除 修该 更改文件名的事件
       watcherName.EnableRaisingEvents = true;

启动服务需要注册服务,再到计算机中的管理中的服务中找到去的名称的服务启动

注册:C:/WINDOWS/Microsoft.NET/Framework/v2.0.50727/InstallUtil.exe(InstallUtil.exe程序) + (服务代码生成的exe程序)。

ResService.cs程序右键点击’添加安装程序‘ 然后Account 是准备什么类型的服务,ServiceName 是服务名称。

 

相关文章:

  • 2022-01-20
  • 2021-09-23
  • 2021-06-10
  • 2022-01-14
  • 2021-11-29
  • 2021-08-14
  • 2021-11-12
猜你喜欢
  • 2021-06-25
  • 2021-12-14
  • 2021-08-20
  • 2022-12-23
  • 2021-07-13
  • 2022-12-23
  • 2021-11-12
相关资源
相似解决方案