Tôi muốn thử sử dụng API Web thực hiện cuộc gọi còn lại nhưng tôi muốn phản hồi là hình ảnh nhị phân thực được lưu trữ trong cơ sở dữ liệu chứ không phải chuỗi mã hóa base64 JSON. Bất cứ ai có một số gợi ý về điều này?ASP .Net Web API tải xuống hình ảnh dưới dạng nhị phân
Update- Đây là những gì tôi đã kết thúc thực hiện:
HttpResponseMessage result = new HttpResponseMessage(HttpStatusCode.OK);
result.Content = new StreamContent(new MemoryStream(profile.Avatar));
result.Content.Headers.ContentType = new MediaTypeHeaderValue("application/octet-stream");
result.Content.Headers.ContentDisposition = new ContentDispositionHeaderValue("attachment");
result.Content.Headers.ContentDisposition.FileName = "avatar.png";
return result;
Tôi nghĩ rằng bài viết này hỏi một câu hỏi tương tự http://stackoverflow.com/questions/8340247/returning- an-image-from-a-restful-wcf-service –