Ι在jQuery中有以下代码
var method = "SaveUploadedOffer";
var url = "/Handler/UserControlHandler.ashx";
var data = { 'method': method, 'UploadedObj':
JSON.stringify(ko.toJS(Selected))};
$.post(url, data,
function (result) {
$("#preloader").css("display","block");
var obj=jQuery.parseJSON(result);
if (obj.IsSucess==true) {
self.SelectedPurpose(null);
self.SelectedPropertyType(null);
jAlert(obj.Message,"Alert...");
$("#preloader").css('display', 'none');
if(obj.Message=="Session expired, please login to continue")
{
$('#popup_ok').on('click', function(e){
window.location = "../rental/home.aspx";
});
}
else
{
$('#popup_ok').on('click', function(e){
window.location = "../user/dashboard.aspx";
});
}
}
else {
jAlert("Something went wrong, please try again later","Error...");
$("#preloader").css("display","block");
}
});
此代码在Firefox中运行良好,但在Chrome中它给我一个错误。
请告诉我如何解决此错误。
答案 0 :(得分:1)
我不确定它为什么在firefox中运行,但是当请求主体大于服务器配置为允许时,会发生413 errors
。
在IIS中设置uploadreadaheadsize
配置设置
以下是在uploadReadAheadSize
IIS 8.5
的步骤
答案 1 :(得分:0)
我已将我的web.config更改为
<configuration>
<system.web>
<!-- This will handle requests up to 20MB -->
<httpRuntime maxRequestLength="20480" timeout="3600" />
</system.web>
</configuration>
<!-- IIS Specific Targeting (noted by the system.webServer section) -->
<system.webServer>
<security>
<requestFiltering>
<!-- This will handle requests up to 20MB -->
<requestLimits maxAllowedContentLength="20971520" />
</requestFiltering>
</security>
</system.webServer>
现在它适用于firefox和chrome。 感谢
答案 2 :(得分:0)
如果在Chrome中,只需将浏览器重置为默认设置即可。为我工作。