如何在chrome浏览器中解决413错误

问题描述 投票:0回答:2

Ι在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中它给了我一个错误。

请告诉我如何解决此错误。

enter image description here

c# jquery asp.net ajax google-chrome
2个回答
1
投票

我不知道为什么它在firefox中工作但是,当请求体大于服务器配置允许时,会发生413 errors

在IIS中设置uploadreadaheadsize配置设置

以下是在uploadReadAheadSize中设置IIS 8.5的步骤

  • 打开IIS
  • 在“默认网站”下导航
  • 向下滚动到管理并打开配置编辑器
  • 选择以下部分(在顶部下拉)system.webServer并展开它,然后找到serverRuntime
  • 你会在那里找到uploadReadAheadSize值的当前值,你可以改变它

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。谢谢

© www.soinside.com 2019 - 2024. All rights reserved.