我尝试通过web api发布请求。我有一个包含图像字段的类。
我的代码:
public bool SendRequest(FaxBranchRecive faxBranchRecive)
{
using (var client = new HttpClient())
{
int fileLength = faxBranchRecive.faxImage.Length;
// fileLength = 3873396
var response = client.PostAsJsonAsync("http://localhost:58000/api/FaxBranch/RecieveFax", faxBranchRecive).Result;
if (response.IsSuccessStatusCode)
{
return true;
}
else
{
return false;
}
}
}
{
StatusCode: 500,
ReasonPhrase: 'Internal Server Error',
Version: 1.1,
Content: System.Net.Http.StreamContent,
Headers:
{
Cache-Control: private
Server: Microsoft-IIS/8.0
X-SourceFiles: =?UTF-8?B?RDpcVE9QRmF4XEZheENvbGxlY3Rpb25cUG9ydGFsRmF4TW9uaXRvcmluZ1xhcGlcRmF4QnJhbmNoXFJlY2lldmVGYXg=?=
X-Powered-By: TOP
X-Content-Type-Options: nosniff
Date: Tue, 02 May 2017 10:07:45 GMT
Content-Length: 4549
Content-Type: text/html; charset=utf-8
}
}
是否需要在服务器中发布大文件的配置?