我有一個應用程序,我需要在每天的某個時間自動化,例如下午6點,它將運行某種方法(即檢查數據庫的關鍵術語,然後訪問api搜索這些條款)。但是,還有另一個進程一直在運行,訪問流api,所以當搜索完成時,它會中斷流並交出新條件。 現在我想添加.exe文件到Windows任務調度器,但不知道這是否會工作。流方法無限期運行,每天下午6點運行另一個進程。我想過使用system.threading.task TaskFactory,但是當我包含它時,它將taskfactory顯示爲undefined。 (我有.NET框架4.0),如果啓動使用任務計劃爲18:00我的代碼邏輯如下:在vb.net中的調度任務
While True
'should i run this method as background
dim gStream as StreamProcess
gStream.module1()
If DateTime.Now.TimeOfDay.ToString = searchTime Then
addKeywordSearchRules = getSTerms.getNewTerms(addKeywordSearchRules)
ruleManip.ruleChanges(ruleMethods.Method.ADD, addKeywordSearchRules)
End If
Dim gSearch As SearchProcess
if not addKeywordSearchRules.count = 0 then
gSearch.module1()
end if
End While
這是否邏輯是否合理?任何其他想法>
如果您使用的是VS2008,那就是爲什麼您沒有看到TaskFactory - 您需要VS2010來定位.NET 4. – 2010-11-22 17:43:54
謝謝我會忘記任務工廠,然後......但就程序邏輯而言我可以繼續嗎 – vbNewbie 2010-11-22 17:55:02