zoukankan      html  css  js  c++  java
  • asp.net core mvc上传大文件解决方案

     默认上传文件大小不超过30M  

    第一个问题:

    IIS 10.0 详细错误 - 404.13 - Not Found

    请求筛选模块被配置为拒绝超过请求内容长度的请求。

    服务器上的请求筛选被配置为拒绝该请求,因为内容长度超过配置的值。

    解决方案:在发布的项目文件夹下面打开webconfig文件,在标签<system.webServer>中加入

        <security>
          <requestFiltering >
            <requestLimits maxAllowedContentLength="2147483647" ></requestLimits>
          </requestFiltering>
        </security>

    这种方法之后最大上传到128M

    第二个问题:

    An unhandled exception occurred while processing the request.
    InvalidDataException: Multipart body length limit 134217728 exceeded

     解决方案:在startup的ConfigureServices方法中做如下处理:

    services.AddMvc();
             //   解决Multipart body length limit 134217728 exceeded
                services.Configure<FormOptions>(x =>
                {
                    x.ValueLengthLimit = 2147483647;
                    x.MultipartBodyLengthLimit = 2147483647; //2G
                });
  • 相关阅读:
    a冲刺总结随笔
    a版本冲刺第十天
    a版本冲刺第九天
    a版本冲刺第八天
    a版本冲刺第七天
    a版本冲刺第六天
    a版本冲刺第五天
    BETA 版冲刺前准备
    Alpha事后诸葛会议
    Alpha答辩总结
  • 原文地址:https://www.cnblogs.com/eggTwo/p/9883148.html
Copyright © 2011-2022 走看看