不可能的,做windows service

解决方案 »

  1.   

    我演讲在ASP.NET里用的global.asax中的application_onstart中引用定时器,还是可以的,但不知道为什么不,有的时候可以按时做一些事.但有的时候不可以CarWebReference.ClInterfaceService webService=new WebPurchaseSystem.CarWebReference.ClInterfaceService(); public Global()
    {
    InitializeComponent();
    }

    protected void Application_Start(Object sender, EventArgs e)
    {
    //用于定时从财政局接收数据
    System.Timers.Timer myTimer=new System.Timers.Timer(120000);
    Application["TransMsg"]="Msg";
    Application["Time"]=DateTime.Now ;
    myTimer.Elapsed+=new ElapsedEventHandler(myTimer_Elapsed);
    myTimer.Enabled=true;
    myTimer.AutoReset=true; }
     
    void myTimer_Elapsed(object source, ElapsedEventArgs e)
    {

    //如果当前日间与原来的间隔超过30分钟
    if((((DateTime)Application["Time"]).AddMinutes(30))<DateTime.Now)
    {
    try
    {
    Carinterface.AppBillInterfce a=new Carinterface.AppBillInterfce();
    Application["TransMsg"]+=a.ExplainAppBillXml(webService.qryDate_AppAuditBill());
    Carinterface.StockBillInterface b=new Carinterface.StockBillInterface();
    Application["TransMsg"]+=b.ExplainStockBalanceBillXml(webService.qryDate_StockBalanceBill());
    Carinterface.NewCarTemp c=new NewCarTemp();
    Application["TransMsg"]+=c.ExplainNewCarTempXml(webService.qryDate_VehiInfor()); Application.Lock();
    Application["Time"]=DateTime.Now;
    //Application["string"]="ying";
    Application.UnLock();
    }
    catch(Exception ee)
    {
    Application["TransMsg"]="Error: "+ee.Message;
    }
    }


    }
      

  2.   

    1同意楼上的,2可以用WEB SERVICE
      

  3.   

    1,windows service,
    2,sql job
    3,将要进行的操作写入一个x.aspx页面.用计划任务在11.30执行打开这个页面的操作
      

  4.   

    还有个办法.那就是写个x.html文件,一个x.aspx文件.x.aspx文件里写上你要进行的操作.x.html用作计时器/x.html里用段js, settimeout 值设置为 30 秒. js每隔30秒读client时间,如果没到11.30, 就继续settimeout, 到了11.30就触发一个xmlhttp操作,触发x.aspx进行操作.在服务器上开个ie窗口,打开这个x.html. 那么client时间就相当于服务器时间了, 并且也不会占用服务器资源
      

  5.   

    如果时间精度要求不高的话,ASPNET可以做到.