我尝试使用WebApi上传文件。字节[]是1.6MB。出于某种原因,我的模型被序列化为null。我怀疑它是文件大小,因为它适用于较小的文件。有什么想法吗?
这就是我所使用的 - 其中数据是包含byte []的模型。
return HttpClient.PostAsJsonAsync<T>(requestUri, data)
.ContinueWith(x => Handle<R>(x.Result), TaskContinuationOptions.AttachedToParent);
答案 0 :(得分:2)
您可能需要更改.config
<system.web>
<httpRuntime maxRequestLength="2097152"/>
</system.web>
<system.webServer>
<security>
<requestFiltering>
<requestLimits maxAllowedContentLength="2147483648" />
</requestFiltering>
</security>
<system.webServer>