使用WCF的REST服务 [英] REST services with WCF

查看:94
本文介绍了使用WCF的REST服务的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述


在我们的一种产品中,我们广泛使用WCF服务.由于我们希望将产品移植到其他平台(Android,Web ...),因此我开始考虑使用.NET来实现REST服务.我发现了很少的API-WCF REST入门工具包,WCF Web api,最后是asp.net Web api.不再支持入门工具包.看来我应该使用asp.net网络api.但是我不确定asp.net Web api是新的东西还是只是被重命名和扩展了WCF Web api.有关WCF Web API的知识是否可以帮助您使用新的asp.net Web API?我不确定的另一件事是如何在Web API中处理双向通信.在WCF中,我使用了TCP绑定,该绑定使您能够从服务器上调用客户端上的方法.在asmx Web服务中,我使用一个客户端打开了与服务器的连接来处理该问题,并且当该客户端的数据可用时,服务器会回复.然后重新打开连接.使用新的Web API时,这是一种有效的方法吗?

Uros

Hi
In one of our products we extensively use WCF services. Since we are looking to port the product to other platforms(Android, web...) I started to look at implementing REST services with .NET. I found quite few APIs - The WCF REST starter kit, the WCF web api, and finally asp.net web api. The starter kit is no longer supported. It seems that I should use the asp.net web api. But I am not sure if the asp.net web api is something new or is just renamed and extended WCF web api. Does knowledge about WCF web api helps you to use the new asp.net web api or not? Another thing I am not sure about is how should the two-way communication be handled in the web api. In WCF I used the TCP binding which enabled you to call a method on a client from the server. In asmx web services I handled that with a client which opened a connection to the server and the server replied when the data for that client was available. Then the connection was re-opened. Is that a valid approach when using the new web api?

Uros

推荐答案

推荐的WCF REST服务开发,正在使用WCF Web API.与ASP.NET MVC 4 Beta一起发布的ASP.NET Web API.该网站上的jQuery内容的WCF Web API和WCF支持将于2012年底删除.

WCF Web API具有以下功能:
HttpClient
对XML,JSON和OData的开箱即用支持
无类型JSON支持
插入任何格式/媒体类型
可查询的支持
基于代码的简单配置模型
支持HTTP文件上传和基于MIME的批处理
集成的Web API测试客户端
Recommended WCF REST service development, is using WCF Web API. ASP.NET Web API released with ASP.NET MVC 4 Beta. The WCF Web API and WCF support for jQuery content on this site wll removed by the end of 2012.

WCF Web API has features like:
HttpClient
Out of the box support for XML, JSON and OData
Typeless JSON support
Plug in any format / media type
IQueryable support
Simple code-based configuration model
Support for HTTP file upload and MIME-based batching
Integrated Web API test client


这篇关于使用WCF的REST服务的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆