【发布时间】:2011-01-26 03:33:13
【问题描述】:
我有通过 Web 服务访问的 xml 数据。我需要读取数据并将其复制到本地。下面的代码工作正常。我现在需要在没有人工干预的情况下每天至少运行两次或三次此代码。我怎么做?谢谢!
using System;
using System.Collections;
using System.Data;
using System.Xml;
class MainClass{
public static void Main(){
XmlDocument doc = new XmlDocument();
// read
doc.Load(new System.IO.StringReader(GetContracts()));
// write
XmlTextWriter tw = new XmlTextWriter( "testOut.xml", null );
tw.Formatting = Formatting.Indented;
tw.Indentation = 4;
doc.Save( tw );
tw.Close();
}
}
【问题讨论】:
-
您正在编写 XML 的事实与问题的根源无关,即...... 我怎样才能每小时运行一个应用程序? 问题是最好在 superuser.com 或 serverfault.com 上询问。
-
对不起,但我在 vb.net 中阅读了有关 Timer Controls 的信息,它设置了执行事件的时间间隔,并认为也许在这里我可以获得更多有关它的信息。
标签: .net windows scheduled-tasks