zoukankan      html  css  js  c++  java
  • .net core部署到ubuntu 上传文件超过30MB

    默认的上传文件不能超过30MB,需要修改几个地方

    一、web.config中添加配置

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

    (1)如果是开发环境,通过IIS Express添加

    (2)如果是生产环境,添加到发布后的web.config中

    在标签<system.webServer>中加入<security>内容

    <?xml version="1.0" encoding="utf-8"?>
    <configuration>
      <location path="." inheritInChildApplications="false">
        <system.webServer>
          <handlers>
            <add name="aspNetCore" path="*" verb="*" modules="AspNetCoreModule" resourceType="Unspecified" />
          </handlers>
          <aspNetCore processPath=".hiRen.Tourism.UI" stdoutLogEnabled="false" stdoutLogFile=".logsstdout" />
       <security>
          <requestFiltering >
            <requestLimits maxAllowedContentLength="2147483647" ></requestLimits>
          </requestFiltering>
        </security>
        </system.webServer>
      </location>
    </configuration>
    <!--ProjectGuid: 74eb1354-a638-4903-8784-2a74d874e010-->
    

      

    二、在startup的ConfigureServices方法中

                services.Configure<FormOptions>(options =>
                {
                    //设置上传文件大小限制
                    options.ValueLengthLimit = int.MaxValue;
                    options.MultipartBodyLengthLimit = int.MaxValue;
                });
    

      

    三、在保存文件的Controller的Action上加标签

            [RequestSizeLimit(1024_000_000)]
            //[DisableRequestSizeLimit]  //或者取消大小的限制
            [HttpPost]
            public async Task<IActionResult> Create(VideoMultipleLanguage ml, IFormCollection fc)
            {
            }
    

      

    四、修改Nginx的配置文件

    位置:/etc/nginx/nginx.conf

    在http{}中加入 

    client_max_body_size 1000m; 

    建议修改连接时间

    keepalive_timeout 1800;

  • 相关阅读:
    由高度场求法线
    unity中的透视投影矩阵
    bindpose定义
    blinn-phong高光反向穿透问题
    fft ocean注解
    理顺FFT
    unity, 在image effect shader中用_CameraDepthTexture重建世界坐标
    unity, ComputeScreenPos 作用
    Lambert漫反射的BRDF
    VC++ MFC获取对话框上控件的位置
  • 原文地址:https://www.cnblogs.com/fireicesion/p/11274813.html
Copyright © 2011-2022 走看看