如何在C#.net中自动执行搜寻器过程? [英] How to automate the process in c#.net for crawler?
问题描述
我正在ASP.NET和C#中设计一个网站,我正在其中执行以下任务.
有一个表List_of_Site,其中包含要爬网的站点列表.还有另一个表Site1_Links,其中包含爬网数据,例如链接,内容等.
我已经在c#asp.net中编写了一个程序,其中在Visual Studio中有一个窗体Home.aspx,并且有一个名为Crawl的按钮.每当我单击按钮时,它就会从表List_of_Site一张一张地获取站点,然后对它们进行爬网以获取可用的新链接,并将它们分别保存在Site1_Links表中.
但是要做到这一点,我需要每次单击按钮,但是我想要一些可以在一定时间间隔内自动完成该过程的东西,例如X分钟.
请提出一种方法?
Hi I am designing a website in ASP.NET and C# in which i am doing following task.
There is a table List_of_Site which contains list of sites to be crawled. And another table Site1_Links which contains crawled data such as links, contents etc.
I have coded a program in c# asp.net in which i have a form Home.aspx in visual studio and there is a button named Crawl. Whenever i click on the button it fetches the sites from table List_of_Site one by one and then crawl them for new links available and the save them respectively at Site1_Links table.
But to do this i need to click on the button each time but i want something that can automate the process for some time interval say X minutes.
Please suggest a way ?
推荐答案
如果您希望进程间歇运行,则可以通过两种方法非常简单地做到这一点. 1)编写一个简单的应用程序来包装您的爬网代码,然后使用Windows Task Scheduler对其进行调度.
2)编写Windows Service应用程序包装程序并将调度代码构建到服务应用程序中.
If you want a process to run intermittently then you can do this quite simply in a couple of ways.
1) Write a simple application to wrap your crawling code and then schedule it using the Windows Task Scheduler.
2) Write a Windows Service application wrapper and build the scheduling code into the service application.
这篇关于如何在C#.net中自动执行搜寻器过程?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!