无法检索对WebApi的Post调用中的冗长base64(超过3 MB)字符串.我只是得到null而不是数据

sar*_*hra 3 c# rest asp.net-web-api

我的请求看起来像这样:

User-Agent:Fiddler Content-Type:application/json; charset = utf-8主持人:localhost:12841内容长度:4512954

我有体内 - >" base64encoded String "

API控制器包含一个方法:

        [HttpPost]
        public bool SaveProductImage([FromBody]string image)
        {
            if(image!=null)
            var result =                         productImageRules.StoreSingleImageOnDisk(image.ToString());            
            return result;
        }
Run Code Online (Sandbox Code Playgroud)

Dom*_*dre 10

确保允许应用程序在web.config中接收大型POST .

这是10mb的一个例子.

对于ASP.NET.

<system.web>
  <httpRuntime targetFramework="4.6" maxRequestLength="102400" executionTimeout="3600" />
</system.web>
Run Code Online (Sandbox Code Playgroud)

对于IIS

<security>
  <requestFiltering>
    <requestLimits maxAllowedContentLength="10485760" />
  </requestFiltering>
</security>
Run Code Online (Sandbox Code Playgroud)