我正在尝试使用 WebApi 上传文件。 byte[] 是 1.6MB。由于某种原因,我的模型被序列化为 null。我怀疑这是文件大小,因为它适用于较小的文件。有什么想法吗?
这就是我正在使用的 - 其中数据是一个包含 byte[] 的模型。
return HttpClient.PostAsJsonAsync<T>(requestUri, data)
.ContinueWith(x => Handle<R>(x.Result), TaskContinuationOptions.AttachedToParent);
最佳答案
可能你需要改变.config
<system.web>
<httpRuntime maxRequestLength="2097152"/>
</system.web>
<system.webServer>
<security>
<requestFiltering>
<requestLimits maxAllowedContentLength="2147483648" />
</requestFiltering>
</security>
<system.webServer>
关于c# - 对于大文件,通过 Web Api 上传文件失败,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/36503772/