asp.net如何实现自动生成静态页 随着IIs的启动 定期调用某个方法来生成静态页,如何实现 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 可以在 Application_Start 事件里执行你的生成操作但不推荐这么做,你可以做成独立的程序来运行你的生成操作 webdownload 或 模板生成 还有自动生成的??定期调用某个方法来生成静态页 ===》可以放到global.asax写个方法试试~~http://www.docin.com/p-701988.html动态转静态实例~~ 生成静态页,用global.asax,用静态页方法,用生成静态页工具。 传入你的URL地址,自动转换静态的到你规定的目录下! 我的想法是 只要我的系统在iis服务器上 不管有没有人去访问它,系统都会自动调用某个方法 在global中加个Timer 如何写这段代码 我没有写过不会,请说详细点 谢谢,学习 可以在gloable中调用声称静态页的方法方法原理:把需要生成静态页的模版页在后台中读到一个字符串中,然后把这个字符串写入到你要生成的静态文件页面中,就可以了 在global中调用timer定时生成文件http://topic.csdn.net/u/20091214/22/0554f114-bc5d-44c1-8ae4-2fb860eea2be.html 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还是没有数据 为什么 没有任何请求来触发Application_Start html内容导出word ASP.NET嵌套进ASP的页面的问题 谁给我讲讲像CSDN这样点击一个主题打开一个网页是怎么实现的? 不是问题的问题,20分轻松拿到 关于TreeView的一点问题,求教! 在DataGrid中添加新行 水晶报表WEB打印问题 DataGrid删除数据时,遇到很多矛盾,请大家帮一下! 再散分!温暖ing 网上商店的建设问题. Jquery与asp.net ajax是UpdatePanel使用问题 AspNetPager分页控件排序的问题
但不推荐这么做,你可以做成独立的程序来运行你的生成操作
定期调用某个方法来生成静态页 ===》可以放到global.asax写个方法试试~~
http://www.docin.com/p-701988.html
动态转静态实例~~
把需要生成静态页的模版页在后台中读到一个字符串中,然后把这个字符串写入到你要生成的静态文件页面中,就可以了
http://topic.csdn.net/u/20091214/22/0554f114-bc5d-44c1-8ae4-2fb860eea2be.html
{
// 在应用程序启动时运行的代码
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还是没有数据 为什么