无法将HttpStringContent转换为HttpContent

时间:2014-10-28 22:50:06

标签: c# windows-store-apps

我尝试创建Windows应用商店应用。我需要发送邮件请求,但我有一个问题。 我的方法:

       private async Task<string> POST(byte[] pic, string upload_url)
    {


        var multipartContent = new System.Net.Http.MultipartFormDataContent();
        multipartContent.Add(new System.Net.Http.ByteArrayContent(pic), "photo");
        var client = new HttpClient();

        var response = await client.PostAsync(
new Uri(upload_url),
multipartContent);
        return await response.Content.ReadAsStringAsync();
    }

返回后我总是有Task成员。状态 - 等待激活。哪里出错?谢谢!

1 个答案:

答案 0 :(得分:4)

我认为你正在混合System.Net.HttpWindows.Web.Http。试试StringContent