简体   繁体   English

适用于Windows 8商店应用的WCF与Web API

[英]WCF vs. Web API for Windows 8 store apps

I suggested we migrate from WCF to Web API due to it being easier to implement and got shot down pretty hard. 我建议我们从WCF迁移到Web API,因为它更容易实现并且很难被击落。 Here were the objections raised: 以下是提出的异议:

  • WebAPI is just made for rails converts WebAPI仅适用于rails转换
  • We have no need for REST or 3rd party open source support, Windows 8 Store Apps with Microsoft backend. 我们不需要REST或第三方开源支持,Windows 8商店应用程序与Microsoft后端。
  • WCF over net.tcp is "MUCH" faster and less overhead than HTTP(S)+XML or JSON WCF over net.tcp比HTTP(S)+ XML或JSON更快,更少开销

The end comment was "I cannot think of a single advantage of using Web API over WCF. 最后的评论是“我想不出使用Web API而不是WCF的单一优势。

Funny, my last job at a big MS tech based enterprise changed from WCF to Web API and dev productivity skyrocketed, lots of bugs disappeared and we never had any performance problems, but I don't want to just say that, I want to respond with facts to his points. 有趣的是,我在一家基于MS技术的大型企业的最后一份工作从WCF变为Web API,开发人员的生产率暴涨,许多漏洞消失,我们从未遇到任何性能问题,但我不想只是这样说,我想回复事实证明了他的观点。 How would you respond? 你会怎么回应?

WCF or ASP.NET Web APIs? WCF或ASP.NET Web API? My two cents on the subject : 关于这个主题的两分钱

  • If your intention is to create services that support special scenarios – one way messaging, message queues, duplex communication etc, then you're better of picking WCF 如果您打算创建支持特殊方案的服务 - 单向消息传递,消息队列,双工通信等,那么您最好选择WCF
  • If you want to create services that can use fast transport channels when available, such as TCP, Named Pipes, or maybe even UDP (in WCF 4.5), and you also want to support HTTP when all other transports are unavailable, then you're better off with WCF and using both SOAP-based bindings and the WebHttp binding. 如果您想创建可用的快速传输通道的服务,例如TCP,命名管道,甚至UDP(在WCF 4.5中),并且您还希望在所有其他传输不可用时支持HTTP,那么您就是最好使用WCF并使用基于SOAP的绑定和WebHttp绑定。
  • If you want to create resource-oriented services over HTTP that can use the full features of HTTP – define cache control for browsers, versioning and concurrency using ETags, pass various content types such as images, documents, HTML pages etc., use URI templates to include Task URIs in your responses, then the new Web APIs are the best choice for you. 如果您想通过HTTP创建面向资源的服务,可以使用HTTP的全部功能 - 使用ETag定义浏览器的缓存控制,版本控制和并发,传递各种内容类型,如图像,文档,HTML页面等,使用URI模板要在您的回复中包含任务URI,那么新的Web API是您的最佳选择。

The whole article is worth a read. 整篇文章值得一读。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM