[英]How to create C# windows service app to run on multiple servers targeting a single folder checking for new files
I need to run an C# window service app on multiple servers to check a single folder for new files, if files found then process them or move them.我需要在多台服务器上运行 C# window 服务应用程序来检查单个文件夹中是否有新文件,如果找到文件则处理它们或移动它们。 Now if ServerA is processing the file, ServerB, ServerC should not process the same file.
现在如果 ServerA 正在处理文件,ServerB、ServerC 不应该处理同一个文件。
I have created the app running on a single server but do not know how to achieve multi machine scenario.我已经创建了在单台服务器上运行的应用程序,但不知道如何实现多机场景。
Thanks for any help.谢谢你的帮助。
I usually just have a separat folder named something like "Processing".我通常只有一个名为“处理”之类的单独文件夹。 As soon as I identify what file to process, I move the file to the processing folder.
一旦确定要处理的文件,我就将文件移动到处理文件夹。 That way, multiple treads accessing the primary folder, is not an issue.
这样,多个线程访问主文件夹就不是问题了。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.