WCF RESTful service and WebGrid in ASP.NET MVC 5
使用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
郑重声明:本站内容如果来自互联网及其他传播媒体,其版权均属原媒体及文章作者所有。转载目的在于传递更多信息及用于网络分享,并不代表本站赞同其观点和对其真实性负责,也不构成任何其他建议。