zoukankan      html  css  js  c++  java
  • .net mvc超过了最大请求长度

    项目中遇到"超过了最大请求长度"如下图所示,是因为IIS默认请求长度4M,当请求长度大于这个值的时候报错.

    修改maxRequestLength:在web.config中我们修改<system.web></system.web>中的maxRequestLength,表示最大请求长度,单位是kb,默认4M

     
    <system.web>
      <!--最大请求长度,单位为kb-->
      <httpRuntime maxRequestLength="20480" />
    </system.web>

    3、修改maxAllowedContentLength:在web.config中我们修改<system.webServer></system.webServer>中的maxAllowedContentLength,表示附件大小上限,单位是字节,默认约30M

     
    <system.webServer>
     <!--允许上传文件长度,单位字节-->
     <security>
       <requestFiltering>
      <requestLimits maxAllowedContentLength="20971520"/>
      </requestFiltering>
     </security>
    </system.webServer>

    注意:maxRequestLength与maxAllowedContentLength的区别

    a、前者表示请求长度,后者表示上传文件的大小;

    b、前者单位kb,后者单位字节;

    c、前者默认值4M,后者默认值30000000B,约30M;

    d、两者的最大值都为2G

  • 相关阅读:
    Docker搭建NSQ实时分布式消息集群
    雪花算法
    代码抽象三原则
    PostgreSQL12-主从复制
    logrus日志框架
    Golang中的布隆过滤器
    golang-Json编码解码
    List分组迭代器
    redis-cli命令行远程连接redis服务
    pycharm常用快捷键与设置
  • 原文地址:https://www.cnblogs.com/fer-team/p/7986258.html
Copyright © 2011-2022 走看看