【问题标题】:C# windows service fileSystemWatcher multiple files at the same timeC# windows服务fileSystemWatcher同时多个文件
【发布时间】:2014-09-24 12:27:56
【问题描述】:

我创建了一个带有文件系统观察程序的 Windows 服务。它获取新添加的文件并执行一些处理。它工作正常,但是当我尝试同时添加更多文件时,它不会按预期工作。只有第一个文件被执行。有什么建议可以解决这个问题吗?

【问题讨论】:

  • 您是如何确定事件丢失的?将代码的相关部分粘贴到您的问题中。

标签: windows-services filesystemwatcher


【解决方案1】:

这是我的代码的一部分。我正在将 excel 文件上传到配置文件观察器的特定目录。

protected override void OnStart(string[] args)
        {
            //Set the location for the file watcher
            fileSystemWatcherPL.Path = @"C:/Temp";
        }

private void fileSystemWatcherPL_Created(object sender, System.IO.FileSystemEventArgs e)
        {
//Read the excel file and do some process.
}

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2011-02-08
    • 1970-01-01
    • 2021-08-13
    • 1970-01-01
    • 1970-01-01
    • 2021-08-14
    • 1970-01-01
    相关资源
    最近更新 更多