如何在xamarin.forms中使用wcf服务?

时间:2017-10-28 11:06:46

标签: wcf xamarin.forms

我是xamrin表单的新手,现在我想访问xamarin中的wcf服务froms`WebRequest request = WebRequest.Create(uri);                 request.Method =" POST&#34 ;;                 request.ContentType =" text / plain;字符集= UTF-8&#34 ;;

            string json = JsonConvert.SerializeObject(ObjInput);                

            using (StreamWriter writer = new StreamWriter(request.GetRequestStream()))
            {
                writer.Write(json);
            }

            HttpWebResponse responce = (HttpWebResponse)request.GetResponse();
            Stream reader = responce.GetResponseStream();

            StreamReader sReader = new StreamReader(reader);
            string outResult = sReader.ReadToEnd();              

            return outResult;` am using this code but getting error in Getresponse stream. 

提前致谢..

1 个答案:

答案 0 :(得分:0)

官方xamarin演练:Walkthrough - Working with WCF

使用WFC的官方xamarin演练:Consuming a Windows Communication Foundation (WCF) Web Service

演练中的官方xamarin示例:WCF Walkthrough Sample