Post 错误状态代码:500,原因短语:';内部服务器错误';用webapi发布大文件
我尝试通过web api发布请求。我有一个包含图像字段的类 我的代码:Post 错误状态代码:500,原因短语:';内部服务器错误';用webapi发布大文件,post,asp.net-web-api,Post,Asp.net Web Api,我尝试通过web api发布请求。我有一个包含图像字段的类 我的代码: public bool SendRequest(FaxBranchRecive FaxBranchRecive) { 使用(var client=new HttpClient()) { int fileLength=faxBranchRecive.faxImage.Length; //fileLength=3873396 var response=client.PostAsJsonAsync(“http://localhos
public bool SendRequest(FaxBranchRecive FaxBranchRecive)
{
使用(var client=new HttpClient())
{
int fileLength=faxBranchRecive.faxImage.Length;
//fileLength=3873396
var response=client.PostAsJsonAsync(“http://localhost:58000/api/FaxBranch/RecieveFax“,FaxBranchRescive)。结果;
if(响应。IsSuccessStatusCode)
{
返回true;
}
其他的
{
返回false;
}
}
}
post显示此错误时:
是否需要配置服务器中的post大文件?已解决。。在web.config中添加maxRequestLength-->
{
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
}
}