WCF服务或Web API [英] WCF Service or Web API

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

问题描述

我将要工作的,涉及一些元素的项目:

I'm going to be working on a project that involves a number of elements:


  • ASP.NET MVC的网站

  • C#控制台应用程序

  • iPhone应用程序

要得到所有这些不同的应用程序聊到数据库中,我立即想到的是使用WCF服务。

To get all these separate applications talking to the database, my immediate thought was to use a WCF Service.

不过,我现在需要一个API添加到站点,允许第三方从自己的应用程序选择,插入和更新记录。

However, I now need to add an API to the site to allow third parties to select, insert and update records from their own applications.

在我的脑海里,我只想在这将使用认证会被锁定,只会给获得一定的方式,我的WCF服务创建一个单独的RESTful服务端点。

In my mind, I would just create a separate RESTful service endpoint on my WCF Service which would be locked down using authentication and would only give access to certain methods.

不过,我一直在今天阅读有关MVC 4在Web API功能,旨在为RESTful API中最新的东西?

However, I've been reading today about the Web API feature in MVC 4 which is meant to be the latest thing for RESTful APIs?

我应该沿着使用Web API的线路走向何方?还是因为我的其他应用程序需要一个Web服务,我应该坚持使用WCF服务?

Should I be going along the line of using the Web API? or because my other applications need a web service, should I stick with a WCF Service?

推荐答案

如果你打算做基于REST的发展那么你肯定会想使用ASP.Net的Web API(最初被称为WCF网页API,并与创建目标的使用.NET制作REST一等公民

If you intend to do RESTful development then you will definitely want to use the ASP.Net Web Api (which was originally called WCF Web Api and created with the goal of "Making REST a first class citizen in .NET".

另一个要考虑的是,WCF REST入门套件是不再支持

Another thing to consider is that the WCF REST Starter kit is no longer supported.

请注意,使用的Web API并不意味着你必须使用ASP.Net MVC或IIS甚至,因为它可以的自托管

Note that using Web Api doesn't mean you have to use ASP.Net MVC or IIS even as it can be self hosted.

有关处理其是非CRUD在本质上,我建议谷歌搜索业务REST非CRUD。我发现非CRUD操作这个博客帖子的RESTful 的网址(特别是有趣的评论)。如果你决定你需要有RPC调用那么这些可能要与WCF完成。这就是说,因为WCF REST正在杀死我不知道什么是最好的解决方案将是。同时具有可能是最好的答案,但同时它不一定是一个很好的答案。

For handling operations which are non-CRUD in nature I'd recommend Googling "REST non-CRUD". I found this blog post RESTful URLs for non-CRUD operations (and particularly the comments interesting). If you decide you NEED to have RPC calls then those may have to be done with WCF. That said since WCF REST is being killed off I'm not sure what the best solution is going to be. Having both is probably the best answer but at the same time it's not necessarily a good answer.

另一种选择将是一个WCF服务OData的,但我不知道这会从iPhone的任何支持。

Another alternative would be a WCF OData Service but I'm not sure if that gets any support from an iPhone.

最后一点,使(可在将来被删除,因为这是时间敏感的)

微软已经提供了,这意味着它是由微软的支持,你不应该升级到RTM文件的任何问题公测正式上线许可证。

Microsoft has provided a Go Live license with the beta which means that it is supported by Microsoft and you shouldn't have any problems upgrading to the file RTM.

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

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