클라이언트입니다 :지원되지 않는 미디어 유형 POST는 웹 API에 여기
using (var client = new HttpClient())
{
client.BaseAddress = new Uri("http://localhost/MP.Business.Implementation.FaceAPI/");
client.DefaultRequestHeaders
.Accept
.Add(new MediaTypeWithQualityHeaderValue("application/octet-stream"));
using (var request = new HttpRequestMessage(HttpMethod.Post, client.BaseAddress + "api/Recognition/Recognize"))
{
request.Content = new ByteArrayContent(pic);
request.Content.Headers.ContentType = new MediaTypeHeaderValue("application/octet-stream");
await client.PostAsync(request.RequestUri, request.Content);
}
}
및 서버 :
[System.Web.Http.HttpPost]
public string Recognize(byte[] img)
{
//do someth with the byte []
}
나는 점점 오전 오류 :
415 Unsupported Media Type
항상 - 요청 엔터티의 미디어 pe 'application/octet-stream'은이 자원에서 지원되지 않습니다. 그것에 대해 무엇을 할 수 있습니까? 내가 여기에 몇 가지 답변 스레드를 찾았지만, 그것은 도움이되지 않았다.