我有以下代码将照片上传到网络服务,我需要从服务获得响应,我在这里使用httpclient课程是我的代码
var fileUploadUrl = Globals.baseUrl + "/laravelProjects/VisWall/public/test";
var client = new HttpClient();
photoStream.Position = 0;
MultipartFormDataContent content = new MultipartFormDataContent();
content.Add(new StreamContent(photoStream), "image", "koko");
await client.PostAsync(fileUploadUrl, content).ContinueWith((postTask) =>
{
postTask.Result.EnsureSuccessStatusCode();
});
}
答案 0 :(得分:0)
我刚刚找到了你应该从结果内容中读取字符串异步的答案
string stringResponse =await postTask.Content.ReadAsStringAsync();