我是 wcf restful service的新手。我想将XML文件从Windows 8商店应用程序传递到 wcf restful service并在服务上打开该文件以保存数据。 ..请帮帮我......
public async void UPLOADFILE(string zipfile)
{
StorageFile file1 = await Windows.Storage.ApplicationData.Current.LocalFolder.GetFileAsync(zipfile);
HttpClient httpClient = new HttpClient();
MultipartFormDataContent MFDcontent = new MultipartFormDataContent("-WINDOWS8-APP");
using (IRandomAccessStream writeStream = await file1.OpenAsync(FileAccessMode.ReadWrite))
{
Stream stream = writeStream.AsStreamForWrite();
HttpContent content = new ByteArrayContent(ReadToEnd(stream));
content.Headers.Add("Content-Disposition", "form-data; name=\"orderFile\"; filename=\"" + zipfile + "\"");
content.Headers.Add("Content-Type", "application/xml");
MFDcontent.Add(content);
string resourceAddress ="http://localhost:33434/Service1.svc/Book/"+zipfile ;
HttpResponseMessage response = await httpClient.PostAsync(resourceAddress, MFDcontent);
}
}