Zaina
Zaina
CC#
Created by Zaina on 3/3/2023 in #help
❔ FILewatcher raise multiple events when a file is created
Hello everyone. I have a code that alert me when a file is created in a folder (the file is created by an external process). the problem is that the event Handlecreated is raised multiple times for a single file. Does anyone know why ? this is the code : string extractionFolder = @"C:\Extractions"; FileSystemWatcher watcher = new FileSystemWatcher(extractionFolder); watcher.Filter = "*.csv"; watcher.Created += HandleCreated; watcher.Error += HandleError; watcher.EnableRaisingEvents = true; private async void HandleCreated(object sender, FileSystemEventArgs e) {
int readAttempt = 0; int maxDuration = 15; while (!IsFileReady(e.FullPath) && readAttempt < maxDuration) { readAttempt++; System.Threading.Thread.Sleep(1000); } if (IsFileReady(e.FullPath)) {
await _hubContext.Clients.All.SendAsync("ReceiveMessage", e.FullPath); }
}
9 replies
CC#
Created by Zaina on 2/10/2023 in #help
❔ process.start() works in debug not in iis
Hello every one. I have an application on iis. The application should run an exe with process start(). The exe is in a folder in the server. This works finely on debug but once I publish it to iis that doesn't work. Does any one have an idea ?
19 replies