在C#Windows Phone 8中使用FilePart发布多部分数据

在C#Windows Phone 8中使用FilePart发布多部分数据,c#,windows-phone-8,httpwebrequest,C#,Windows Phone 8,Httpwebrequest,我在c中将图像发布到我的WebService时遇到了一些问题 Web服务是用JAVA编写的 public static int myFunction(MultipartFormData data) { List<FilePart> files = data.getFiles(); //... } 公共静态int-myFunction(MultipartFormData){ List files=data.getFiles(); //... } 我不知道

我在
c
中将图像发布到我的
WebService
时遇到了一些问题

Web服务是用JAVA编写的

public static int myFunction(MultipartFormData data) {
    List<FilePart> files = data.getFiles();
          //...
}
公共静态int-myFunction(MultipartFormData){
List files=data.getFiles();
//...
}
我不知道如何在Windows Phone的
c#
中发送此
文件部分的列表


感谢您的帮助

您将获得Web服务的Url,对吗?然后你可以使用

MultipartFormDataContent content = new MultipartFormDataContent();
您的文件应转换为内存流,并应添加到内容中

content.Add(new StreamContent(yourData), "filename", fileName);

HttpResponseMessage response = await client.PostAsync(fileUploadUrl, content);

response.EnsureSuccessStatusCode();

string responseBodyAsText = await response.Content.ReadAsStringAsync();

Erreur 7 Le type ou Le nom d'espace de noms'MultipartFormDataContent'est introvable(使用ou un e référence d'assembly est elle manquante的une指令)添加reference System.Net.Http和use.System.Net.Http->Http在我的项目中不存在通过Nuget将其添加到您的引用中。您是第一次执行.Net project吗?您可以执行请求,现在您必须识别错误、检查参数、参数名称等。在请求中