我可以使用SignalR 3或AJAX停止长时间文件下载的超时吗
我有一篇ajax文章,它向服务器发送一个CSV文件。我让信号员3通过进度条通知客户其处理16000多条记录的位置。它起作用了。。。。对于处理时间不到两分钟的小文件。任何时间处理都需要更长的超时时间 我已经看过了,这不是我想要的。。及 我曾尝试在帖子中使用“.timeout:600000”添加一个扩展超时,但这不起作用。它仍然在2分钟内超时,但处理工作正常,数据库仍在更新,它甚至尝试发回那些新记录 我可以使用SignalR服务器调用保持会话活动吗?(如何使用信号机3) 我可以使用AJAX吗 我需要它等待刚刚超过8分钟,以避免超时 AJAX代码:我可以使用SignalR 3或AJAX停止长时间文件下载的超时吗,ajax,signalr,Ajax,Signalr,我有一篇ajax文章,它向服务器发送一个CSV文件。我让信号员3通过进度条通知客户其处理16000多条记录的位置。它起作用了。。。。对于处理时间不到两分钟的小文件。任何时间处理都需要更长的超时时间 我已经看过了,这不是我想要的。。及 我曾尝试在帖子中使用“.timeout:600000”添加一个扩展超时,但这不起作用。它仍然在2分钟内超时,但处理工作正常,数据库仍在更新,它甚至尝试发回那些新记录 我可以使用SignalR服务器调用保持会话活动吗?(如何使用信号机3) 我可以使用AJAX吗 我需要
//On button click POST file and signalR connection Id back to controller.
$('#SubmitFile').click(function (e) {
e.preventDefault(); // <------------------ stop default behaviour of button
var url = "/SuburbsAndPostcodesAdmin/FileIndexView";
var connId = $.connection.hub.id;
var fd = new FormData();
fd.append('File', $("#txtFileUpload")[0].files[0]);
fd.append('connId', connId);
//Post back the file with the SignalR Id.
$.ajax({
type: "POST",
url: url,
data: fd,
processData: false,
contentType: false,
success: function (result) {
//display the results in a partial view.
$("#DisplayResults").html(result);
},
error: function (xhr, status, error) {
alert(xhr.responseText);
},
});
});
你试图增加连接时间<代码>GlobalHost.Configuration.ConnectionTimeout=TimeSpan.FromSeconds(110)。当您有大的CSV文件时,
notifyProgress
消息每隔120秒发送一次?
// Reference the auto-generated proxy for the hub.
var progress = $.connection.progressHub;
// Start the connection.
$.connection.hub.start().done(function () {
connectionId = $.connection.hub.id;
$("#SubmitFile").removeAttr("disabled");
$("#initialise").html("<h4>" + "Ready to upload" + "</h4>" + "<br /> " + "<br />");
});
//Send from server to the client process current notification.
progress.client.notifyProgress = function (processedRecords, newRecords, percentage) {
$("#NoOfRecordsProcessedValue").text(processedRecords);
$("#NoOfNewRecordsFoundValue").text(newRecords);
$('.progress-bar')
.css('width', percentage + '%')
.attr('aria-valuenow', percentage);
if (percentage > 5) {
$("#workDone").text(percentage + "%");
}
};