创建和部署文件观察程序的最佳选项 [英] Best options to create and deploy file watcher

查看:61
本文介绍了创建和部署文件观察程序的最佳选项的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好,



我需要开发一个应用程序来读取平面文件并更新到我们的SQL Server数据库中,它必须查看21个不同的文件夹。



我的问题如下



1.什么是适合的最佳应用类型这种情况?



2.我打算将它作为控制台应用程序开发并将其部署为计划任务,这是一种更好的方法吗?或Windows服务或SQL作业甚至消息队列是一个更好的选择?



3.我是否需要部署文件监视器或只是文件监视器将照顾一切甚至没有部署。



提前致谢。



我尝试过:



我在网上搜索并向朋友和同事询问任何帮助都非常感谢,可能是代码片段,链接甚至建议都会有所帮助。

解决方案

我假设FileWatcher你在谈论C#的FileSystemWatcher。



引用:

1。什么是适合此类场景的最佳应用类型?





我建议使用Windows服务。你需要的唯一方法是确定服务是否关闭,在我看来你被提醒它



引用:

2。我打算将它作为控制台应用程序开发并将其部署为计划任务,这是一种更好的方法吗?或Windows服务或SQL作业甚至消息队列是一个更好的选择?





考虑C#中的FileSystemWatcher类将持续监视目录中的更改并发出警报对这些更改,执行按计划运行的控制台应用程序会破坏FileSystemWatcher的用途。



引用:
3。我是否需要部署文件监视器,或者只需文件监视器就可以处理所有事情而无需部署。





你需要部署FileSystemWatcher但是你看到适合。如果您将其作为服务,控制台应用程序,作业进行,则需要部署。


请先阅读我对该问题的评论。



似乎,CP KB充满了或多或少适合您的解决方案:

使用FileSystemWatcher监控多个目录 [ ^ ]

C#:应用程序使用FileSystem Watcher监视文件或目录 [ ^ ]

如何在C#中实现简单的filewatcher Windows服务 [ ^ ]


如果您只需要修改SQL Server数据库中的数据,我就是' d考虑使用SSIS。当然,可以创建一个程序或服务,并在连续循环中运行它,并在需要时进行修改。



如果你在lesat标准版中使用,你已经在SQL Server中拥有类似的功能。 SSIS可用于监视文件夹并在发生更改时运行任务。



有关更多信息,请查看WMI事件观察器任务 [ ^ ]和 WMI活动观察者SSIS - YouTube [ ^ ]


Hi all,

I need to develop an application which goes and reads the flat files and updates into our SQL Server database and it has to look into 21 different folders.

My questions are as follows

1. What is the best type of application suitable for this type of scenarios?

2. I am planning to develop it as a Console app and deploy it as Scheduled Task, is it a better approach? or Windows Service or SQL Job or even Message Queue a better option?

3. Do I need to even deploy the File Watcher or just File Watcher would take care of everything without deployment even.

Thanks in advance.

What I have tried:

I am searching online and inquiring with friends and colleagues any help is greatly appreciated, maybe a code snippet, a link or even a suggestion would be helpful.

解决方案

I am assuming by FileWatcher you are talking about C#'s FileSystemWatcher.

Quote:

1. What is the best type of application suitable for this type of scenarios?



I would recommend a windows service. The only thing you'd need is some way of making sure if the service is off, that you are alerted to it in my opinion

Quote:

2. I am planning to develop it as a Console app and deploy it as Scheduled Task, is it a better approach? or Windows Service or SQL Job or even Message Queue a better option?



Considering the FileSystemWatcher class in C# will continuously monitor a directory for changes and raise alerts to those changes, doing a console application that runs on a schedule defeats the purpose of FileSystemWatcher.

Quote:

3. Do I need to even deploy the File Watcher or just File Watcher would take care of everything without deployment even.



You need to deploy FileSystemWatcher however you see fit. If you do it as a service, console app, job it'll need to be deployed.


Please, read my comment to the question first.

Seems, CP KB is full of solutions more or less suitable for you:
Using FileSystemWatcher to monitor multiple directories[^]
C#: Application to Watch a File or Directory using FileSystem Watcher[^]
How to implement a simple filewatcher Windows service in C#[^]


If you only need to make modifications to the data in an SQL Server database, I'd consider using SSIS. Of course it's possible to create a program or service and run it in continuous loop to and make modifications when needed.

Taken that you use at lesat Standard Edition, you already have similar capabilities within SQL Server. SSIS can be used to both monitor folders and to run tasks when changes occur.

For more information have a look at WMI Event Watcher Task[^] and WMI Event Watcher SSIS - YouTube[^]


这篇关于创建和部署文件观察程序的最佳选项的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆