<output id="qn6qe"></output>

    1. <output id="qn6qe"><tt id="qn6qe"></tt></output>
    2. <strike id="qn6qe"></strike>

      亚洲 日本 欧洲 欧美 视频,日韩中文字幕有码av,一本一道av中文字幕无码,国产线播放免费人成视频播放,人妻少妇偷人无码视频,日夜啪啪一区二区三区,国产尤物精品自在拍视频首页,久热这里只有精品12

      [ASP.NET Core] 請求大小限制(轉載)

      請求大小一般在文件上傳的時候會用到,當然也防止傳過來的參數過大情況。

      一、設置請求體的最大值

      如果不設置請求體大小默認是 30_000_000 bytes,大約28.6MB,當超出大小時會出現如下錯誤:

      錯誤:Failed to read the request form. Request body too large. The max request body size is 30000000 bytes.

      解決方案:

      builder.WebHost.ConfigureKestrel((context, options) =>
      {
          //設置最大1G, 這里的單位是byte
          options.Limits.MaxRequestBodySize = 1073741824;
      });

      如果傳參用的不是表單的形式(如文件上傳)這樣處理是足夠了的,如果是則還需要設置表單的最大長度。

      二、設置表單的最大值

      如果不設置表單長度默認是 134,217,728 bytes,大約128MB,當超出大小時會出現如下錯誤:

      錯誤:Failed to read the request form. Multipart body length limit 134217728 exceeded.

      解決方案:

      builder.Services.Configure<FormOptions>(option =>
      {
          //設置最大1G, 這里的單位是byte
          option.MultipartBodyLengthLimit = 1073741824;
      });

      三、IIS下的配置

      如果是掛在IIS下,還需如下操作:

      1. 修改C:\Windows\System32\inetsrv\config\schema\IIS_schema.xml中maxAllowedContentLength的大小;
      2. 修改項目web.config配置system.webServer/serverRuntime/maxRequestEntityAllowed的大小;
      3. 修改項目web.config配置system.web/httpRuntime/maxRequestLength的大小;
      4. 重啟IIS。

      文章轉載于:https://www.helloworld.net/p/9291788101

       

       

      下面是github的issue,基本上可以解決大部分請求遇到的大小限制問題,可根據自己需要添加相關代碼:

      https://github.com/dotnet/aspnetcore/issues/20369

      1. IIS content length limit

      The default request limit (maxAllowedContentLength) is 30,000,000 bytes, which is approximately 28.6MB. Customize the limit in the web.config file:

      <system.webServer>
        <security>
          <requestFiltering>
            <!-- Handle requests up to 1 GB -->
            <requestLimits maxAllowedContentLength="1073741824" />
          </requestFiltering>
        </security>
      </system.webServer>
      

      Note: Without this application running on IIS would not work.

      2. ASP.NET Core Request length limit:

      For application running on IIS:

       services.Configure<IISServerOptions>(options =>
       {
            options.MaxRequestBodySize = int.MaxValue;
       });
      

      For application running on Kestrel:

      services.Configure<KestrelServerOptions>(options =>
      {
           options.Limits.MaxRequestBodySize = int.MaxValue; // if don't set default value is: 30 MB
      });
      

      3. Form's MultipartBodyLengthLimit

      services.Configure<FormOptions>(x =>
      {
           x.ValueLengthLimit = int.MaxValue;
           x.MultipartBodyLengthLimit = int.MaxValue; // if don't set default value is: 128 MB
           x.MultipartHeadersLengthLimit = int.MaxValue;
      });
      
       

      Adding all the above options will solve the problem related to the file upload with size more than 30.0 MB.



       

      posted @ 2023-06-08 18:57  淺巷深念  閱讀(2550)  評論(0)    收藏  舉報
      主站蜘蛛池模板: 日韩精品成人区中文字幕| 亚欧洲乱码视频在线专区| 国产欧美日韩综合精品二区| 伊人春色激情综合激情网| 上思县| 麻豆精产国品一二三区区| 日韩有码中文在线观看| 国产一区二区精品久久岳| 香蕉EEWW99国产精选免费| VA在线看国产免费| 麻豆国产97在线 | 欧美| 在线观看无码av免费不卡网站| 97精品尹人久久大香线蕉| 少妇高潮喷水久久久影院| 蜜桃视频一区二区三区四| 亚洲精品国产中文字幕| 永久免费无码成人网站| 亚洲狼人久久伊人久久伊| 国产白嫩护士在线播放| 欧洲美熟女乱av在免费| xxxxbbbb欧美残疾人| 伊人精品成人久久综合97| 亚洲美女少妇偷拍萌白酱| 欧美激情内射喷水高潮| 亚洲在战av极品无码| 日本中文字幕有码在线视频| 波多野结衣av高清一区二区三区| 好男人日本社区www| 中文字幕精品人妻丝袜| 中国猛少妇色xxxxx| 亚洲成人四虎在线播放| 亚洲AV日韩AV永久无码电影| 中文字幕久久人妻熟人妻| 极品无码国模国产在线观看| 久久精品国产亚洲av久| 永平县| 护士张开腿被奷日出白浆| 亚洲精品国产av成拍色拍个| yy111111在线尤物| 久久久久国产精品熟女影院| 国产做爰xxxⅹ久久久精华液 |