gpt4 book ai didi

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

转载 作者:行者123 更新时间:2023-11-30 13:30:18 24 4
gpt4 key购买 nike

我的请求看起来像这样:

用户代理: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/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com