Reputation: 2779
I am writing an ASP.NET class that interfaces with an external application. The flow of the transaction between the web server and this application is as follows:
The 1-5 seconds it can take for the external application to process my file is my problem. The most straightforward way to wait for the file seems to be something like this:
Do While Not File.Exists(f)
Thread.Sleep(500)
Loop
Of course, Thread.Sleep() completely locks up the rest of my website until the outside application processes the file. Clearly, this is not a workable solution.
How can I effectively "wait" for my file to be processed without locking up the rest of my website?
Upvotes: 0
Views: 776
Reputation: 499092
Use the FileSystemWatcher
- when a file will be created it will fire an event that you can subscribe to.
Upvotes: 2