【发布时间】:2017-09-02 03:41:00
【问题描述】:
在我的 MVC 应用程序中,控制器返回一个值,但视图永远不会得到它,我得到错误: "远程主机已关闭连接。错误代码为 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" />
但这并没有帮助。
【问题讨论】:
标签: c# asp.net-mvc