在我的MVC应用程序中,Controller返回一个值,但是视图永远不会得到它,我得到错误: “远程主机已关闭连接。错误代码为xxxxxx”
public ActionResult FileUpload(string positionDate)
{
ReturnVal = "very Lenghty Operation , comes back in 1 hour"
return Content(ReturnVal);
}
catch (Exception ex)
{
//Console.WriteLine(ex.Message);
_logger.InfoFormat("DataFileUpload failed with Message {0}", ex.Message);
throw ex;
}
}
ReturnVal有我需要的信息。
function OnClick(s, e) {
positionDate = ReportingPositionDate.GetDate().toDateString();
//debugger;
if (true) {
$.ajax({
type: "POST",
url: "@Url.Action("FileUpload", "ImportData")",
data: JSON.stringify({ positionDate: positionDate }),
dataType: "text",
contentType: "application/json; charset=utf-8",
beforeSend: function () { lpImport.Show(); },
success: function (msg)
{
ImportDataGridView.PerformCallback();
ImportSuccessMessage.SetText(msg);
lpImport.Hide();
},
Error: function (xhr) {
alert(xhr)
ImportDataGridView.PerformCallback();
},
timeout: 10000000
})
任何想法如何增加此超时?操作在60分钟内完成后,我的视图获得了价值。之后它以“远程主机关闭连接”失败。 web.config有
<httpRuntime targetFramework="4.5.1" maxRequestLength="2097151" executionTimeout="21600" />
<sessionState mode="InProc" cookieless="true" timeout="500" />
但它没有帮助。
答案 0 :(得分:1)