目的:在IIS的根目录有个update.asp文件(windows2003+asp+IIS+sqlserver2000),每隔1小时运行这个文件。想用winfrom+2008+c#写个程序,最小化驻留在服务器任务栏上,用于每隔1小去运行一次updata.asp。
请前辈指点一下:1、这种思路可行不? 2、如果可行,帮小弟写个代码(刚学这个,不懂的地方太多了),小弟先感谢了!

解决方案 »

  1.   

    做个线程,然后调用系统的System .Timers .Timer类,创建个新对象timer
                System .Timers .Timer timer = new System.Timers.Timer();
                time.Interval = 1000*3600;
                time.Elapsed += new ElapsedEventHandler(time_Elapsed);
            void time_Elapsed(object sender, ElapsedEventArgs e)
            {
                 //在这里面写你要运行的东西
            }
      

  2.   

    使用windows service来实现怎么样?参见:
    http://blog.csdn.net/jiezigege/archive/2010/02/02/5280582.aspx
      

  3.   

    直接用 Shell Scripting 库执行 updata.asp,甚至,你可以根据 updata.asp 的内容,将代码整合成 SQL Server Job 或者你的程序内,会更好。
      

  4.   


    1、 shell scripting 是个什么东东啊,请前辈帮忙写个例子好吗?先感谢了!
    2、updata.asp里边涉及到js的语句调用google map api 的东西,估计可以整合不?
      

  5.   


    1、 shell scripting 是个什么东东啊,请前辈帮忙写个例子好吗?先感谢了!
    2、updata.asp里边涉及到js的语句调用google map api 的东西,估计可以整合不?
      

  6.   

    这也是个很好的例子,不错!
    http://topic.csdn.net/u/20091011/01/b3ede43d-753e-47f7-a784-fc21106d8f83.html