我的请求看起来像这样:
用户代理:Fiddler 内容类型:application/json;字符集=utf-8 主机:本地主机:12841 内容长度:4512954
Inside Body I have--> "base64encoded String"
API Controller 包含一个方法:
[HttpPost]
public bool SaveProductImage([FromBody]string image)
{
if(image!=null)
var result = productImageRules.StoreSingleImageOnDisk(image.ToString());
return result;
}
最佳答案
确保在您的 web.config 中允许应用程序接收大型 POST。
这里有一个 10mb 的例子。
对于 ASP.NET。
<system.web>
<httpRuntime targetFramework="4.6" maxRequestLength="102400" executionTimeout="3600" />
</system.web>
对于 IIS
<security>
<requestFiltering>
<requestLimits maxAllowedContentLength="10485760" />
</requestFiltering>
</security>
关于c# - 无法检索到 WebApi 的 Post 调用中的冗长 base64(超过 3 MB)字符串。我只是得到 null 而不是数据,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/36527873/