【发布时间】:2015-04-08 15:57:45
【问题描述】:
我有一个非常简单的 dto
public class RisRequest
{
public string APIKey { get; set; }
public string Message { get; set; }
}
还有一个不错的简单 web api
[HttpPost]
public HttpResponseMessage rad(RisRequest request)
99% 的时间它都有效。但是当我遇到消息长于标准(>100,000 个字符和 112kb)的请求时,此参数为空。请注意 APIKey 仍然很好,我的 RisRequest 对象不是 null,而是只有 eMessage 参数。
我做了一些谷歌搜索并尝试了很多选项
根据This link,我尝试设置 httpconfig 缓冲区
config.Formatters.FormUrlEncodedFormatter.ReadBufferSize = int.MaxValue/10;
我尝试了this link 中的 web.config 选项
<system.webServer>
<security>
<requestFiltering>
<requestLimits maxAllowedContentLength="2147483648" />
</requestFiltering>
</security>
</system.webServer>
和
<system.web>
<httpRuntime maxRequestLength="2097152" />
</system.web>
也没有运气。所有其他一些建议相同的变体。 有什么想法我哪里出错了吗?
谢谢
【问题讨论】:
标签: c#-4.0 asp.net-mvc-5 asp.net-web-api2