Restful风格wcf调用
写在前面 上篇文章介绍如何将wcf项目,修改成restful风格的接口,并在上面提供了查询的功能,上篇文章中也感谢园友在评论中的提的建议,自己也思考了下,确实是那个道理。在urltemplate中,定义的url确实不规范,虽然能实现功能,但是缺少点专业性。rest风格的请求,是通过post,delete,get,put等请求方法来区别的,而不是通过在url中取不同的名字来进行区别。这里再次感谢@~Js园友提醒。 在这篇文章中将最新的代码贴出来,方便查看。 系列文章 Restful风格wcf调用 (其中代码中的uritemplate定义不规范,建议参考本文) 代码示例 using System; using System.Collections.Generic; using System.Linq; using System.Runtime.Serialization; using System.ServiceModel; using System.ServiceModel.Web; using System.Text; using System.Web.Script.Services; namespace Wolfy.WCFRestfuleDemo { // NOTE: You can use the "Rename" command on the "Refactor" menu