控制器中未设置变量值

时间:2015-08-13 11:37:37

标签: c# asp.net-mvc

控制器是:

bool isThreadComplete = false;
public ActionResult generateDoc()
{            
    Thread thread = new Thread(threadSleep);
    thread.Start();
    return Json(true);
}
public void threadSleep()
{
    Thread.Sleep(30000);
    isThreadComplete = true;
}
public ActionResult callThreadSleep() {
    return Json(isThreadComplete);
}

当我使用ajax调用callThreadSleep时,即使在30秒之后它也没有设置变量isThreadComplete的值。任何建议?

0 个答案:

没有答案