[英]long running ajax request preventing page reload
我正在使用jquery向控制器方法发出ajax请求,这可能需要一段时间才能返回。 我遇到的问题是,在ajax请求完成之前,我无法重新加载页面。它只是挂起,直到controller方法完成,然后才重新加载页面。
这是我的ajax请求。
$.ajax({ async:true, type: "POST", url: url, data: senddata, dataType: "xml", success: GetLayerFeaturesCallback });
我正在使用AsyncController并等待10秒返回。
public void GetFeaturesAsync(int layerId, BoundingBox bbox, int maxFeatures = 50)
{
AsyncManager.OutstandingOperations.Increment();
Task task = Task.Factory.StartNew(() => {
System.Threading.Thread.Sleep(10000);
});
task.ContinueWith(t => {
AsyncManager.Parameters["element"] = new XElement("TEST");
AsyncManager.OutstandingOperations.Decrement();
});
}
public XmlActionResult GetFeaturesCompleted(XElement element)
{
return new XmlActionResult(element);
}
在该方法完成之前,为什么不能重新加载页面?
可能是应用程序中的死锁,或者允许处理的线程或连接数(每个ip)受Web服务器限制。
在处理长请求时,可以从其他浏览器或其他计算机打开任何其他页面吗?
在asp.net中进行编辑会话也会导致锁定。 除非您将页面的会话标记为只读,否则一次只能访问一个会话。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.