网站有项功能是将数据库里新闻生成为html格式,写到硬盘里,每次执行时网站就访问巨慢,且如果生成数量较多会引发http超时.
我想能否开启新的线程,将生成html和访问网站分开,还有就是不受生成数量限制,不超时,直到任务完成。

解决方案 »

  1.   

       System.Threading.Thread t = new System.Threading.Thread(new System.Threading.ThreadStart(方法));
                t.Start()关键问题是状态同步问题。你要怎么知道他执行结束了?页面是直接就返回的。
      

  2.   

    这种跟纯后台事务,
    单独写个服务就行了,
    不要跟网站搅和在一起!
    通过IIS做这种操作,
    很要命!!
      

  3.   

    System.Threading.Thread thread1 = new System.Threading.Thread(delegate()
     {                                                                        System.Threading.Thread.Sleep(5000);
    });
    thread1.Start();
     while (true)
                {
    if (thread1.ThreadState != System.Threading.ThreadState.Stopped) continue;
                    break;
                }