混合内容问题和 413(请求实体太大)

Mixed Content problem and 413 (Request Entity Too Large)

我想在asp.net MVC中上传图片,网站是HTTPS,API是HTTP,出现以下错误(我发现了几个关于这个问题的问题,但无法解决问题):

Mixed Content The page at was loaded over HTTPS but requested an insecure resource This request has been blocked the content must be served over HTTPS

我将此代码添加到 web.config

<httpProtocol>
        <customHeaders>
            <add name="Content-Security-Policy" value="upgrade-insecure-requests" />
        </customHeaders>
    </httpProtocol>

出现新的错误

413 (Request Entity Too Large)

但是图片大小是50kb

  1. 打开 IIS
  2. Select 网站
  3. 打开配置编辑器
  4. Select system.webServer展开,然后找到serverRuntime
  5. 将 uploadReadAheadSize 值更改为 104857600