随着IIs的启动 定期调用某个方法来生成静态页,如何实现

解决方案 »

  1.   

    可以在 Application_Start 事件里执行你的生成操作
    但不推荐这么做,你可以做成独立的程序来运行你的生成操作
      

  2.   

    webdownload 或 模板生成
      

  3.   

    还有自动生成的??
    定期调用某个方法来生成静态页 ===》可以放到global.asax写个方法试试~~
    http://www.docin.com/p-701988.html
    动态转静态实例~~
      

  4.   

    生成静态页,用global.asax,用静态页方法,用生成静态页工具。
      

  5.   

           传入你的URL地址,自动转换静态的到你规定的目录下!
      

  6.   

    我的想法是 只要我的系统在iis服务器上 不管有没有人去访问它,系统都会自动调用某个方法
      

  7.   

    在global中加个Timer 如何写这段代码 我没有写过不会,请说详细点 谢谢,学习
      

  8.   

    可以在gloable中调用声称静态页的方法方法原理:
    把需要生成静态页的模版页在后台中读到一个字符串中,然后把这个字符串写入到你要生成的静态文件页面中,就可以了
      

  9.   

    在global中调用timer定时生成文件
    http://topic.csdn.net/u/20091214/22/0554f114-bc5d-44c1-8ae4-2fb860eea2be.html
      

  10.   

    script runat="server">    void Application_Start(object sender, EventArgs e) 
        {
            // 在应用程序启动时运行的代码
            System.Timers.Timer myTimer = new System.Timers.Timer();
            myTimer.Elapsed += new System.Timers.ElapsedEventHandler(myTimer_Elapsed);
            myTimer.Interval = 10;
            myTimer.Enabled = true;    }    void myTimer_Elapsed(object sender, System.Timers.ElapsedEventArgs e)
        {
            System.IO.FileStream fs = new System.IO.FileStream(@"D:\1.txt", System.IO.FileMode.OpenOrCreate);
            System.IO.StreamWriter sw = new System.IO.StreamWriter(fs, System.Text.Encoding.Default);
            sw.WriteLine("1");
            sw.Flush();
            sw.Close();
        }
        
        void Application_End(object sender, EventArgs e) 
        {
            //  在应用程序关闭时运行的代码    }
            
        void Application_Error(object sender, EventArgs e) 
        { 
            // 在出现未处理的错误时运行的代码    }    void Session_Start(object sender, EventArgs e) 
        {
            // 在新会话启动时运行的代码    }    void Session_End(object sender, EventArgs e) 
        {
            // 在会话结束时运行的代码。 
            // 注意: 只有在 Web.config 文件中的 sessionstate 模式设置为
            // InProc 时,才会引发 Session_End 事件。如果会话模式设置为 StateServer 
            // 或 SQLServer,则不会引发该事件。    }
           
    </script>这是我写的代码,但是我发布到本地的IIS上,隔离好长时间 但是D盘下的1.txt还是没有数据 为什么
      

  11.   

    没有任何请求来触发Application_Start