如何使用多部分表单数据输入执行wcf服务。我做了一个Web服务,它获取图像的byte []并将其保存在本地路径中并发送url的路径。我已经使用c#windows / web应用程序对此进行了测试,该应用程序工作正常,但是客户端应用程序(如使用Objective c)无法联系服务并发送byte []。因此我切换到wcf服务,我认为可以很容易地做到这一点。顺便说一下我也不太了解wcf ..下面是我在我的wp7应用程序中使用的样本片段。
WebClient webClient = new WebClient();
webClient.Headers[HttpRequestHeader.ContentType] = "application/x-www-form-urlencoded";
var uri = new Uri("http://localhost/snap/service.asmx/getImages");
StringBuilder postData = new StringBuilder();
postData.AppendFormat("&{0}={1}", "EventName", HttpUtility.UrlEncode("sample"));
postData.AppendFormat("&{0}={1}", "EventVenue", HttpUtility.UrlEncode("chennai"));
webClient.Headers[HttpRequestHeader.ContentLength] = postData.Length.ToString();
webClient.UploadStringCompleted += new UploadStringCompletedEventHandler(webClient_UploadStringCompleted);
webClient.UploadStringAsync(uri, "POST", postData.ToString());
提前致谢...