码迷,mamicode.com
首页 > Web开发 > 详细

[转]WCF RESTful service and WebGrid in ASP.NET MVC 5

时间:2015-01-25 01:20:11      阅读:185      评论:0      收藏:0      [点我收藏+]

标签:

使用WebClient调用WCF服务

流程:从View获取实体类-->序列化-->写入内存流中-->传给远端的WCF服务

Get、POST、PUT、DELETE

  using (WebClient wc = new WebClient())
            {
                MemoryStream ms = new MemoryStream();
                DataContractJsonSerializer serializerToUplaod = new DataContractJsonSerializer(typeof(Customer));
                serializerToUplaod.WriteObject(ms, id);
                wc.Headers["Content-type"] = "application/json";
                wc.UploadData(customerServiceUri + "DeleteCustomer", "DELETE", ms.ToArray());
            }

http://www.codeproject.com/Articles/788580/WCF-RESTful-service-and-WebGrid-in-ASP-NET-MVC-P

http://www.codeproject.com/Articles/788583/WCF-RESTful-service-and-WebGrid-in-ASP-NET-MVC-Par

 

 

http://www.codeproject.com/Articles/35982/REST-WCF-and-Streams-Getting-Rid-of-those-Names-Sp

[转]WCF RESTful service and WebGrid in ASP.NET MVC 5

标签:

原文地址:http://www.cnblogs.com/gossip/p/4246890.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!