Rest vs Wcf pros and cons

What are the pros and cons of using a rest service vs a wcf service?

I am wondering which type to use and I was interested to find some sort of comparision.


Rest is a way of doing communication over the internet. It is a very basic process of picking addresses to serve as method locations and returning HTML standard data (javascript, css, html of course).

WCF is a .net library used to have two programs talk to each other using SOAP. Which consists of two very familiar programs trading class info.

Seeing as Rest is a process, and WCF is a class library, a better question might be "Rest vs Soap".

The bottom line is, if you need two apps to talk, you might want to use WCF. Even if the apps are not both written in .net. However if you need information to be accessed by web tech(usualy javascript access is done this way) you'll want to use Rest.

Just a quick side note though, WCF does Rest well too, so you realy can't go wrong there.


You're asking a question about apples and oranges. REST is pattern used in creating web services. I'm not an expert on it, but you can find plenty of details on Wikipedia. WCF is a Microsoft technology for creating web services (primarily using SOAP, although it's so configurable that you can do REST on it as well - see ASP.Net WebAPI).

Pros for WCF:

  • Very configurable - If you can imagine it, WCF can probably do it.
  • Simple to use if you're sticking to the Microsoft stack. Visual Studio does 90% of the work for you.
  • Cons for WCF:

  • Very configurable - It can be a bit of a pain to get it do exactly what you want sometimes, especially if you're new to it.
  • There can be some problems communicating between different technology stacks. I've heard of Java services curling up and dying when pointed at a WCF service. As far as I've heard, this is a problem with the Java libraries, not WCF, but who knows for sure.
  • That's all that comes to mind right now, but hopefully that gives a you a decent impression on WCF.


    If you are absolutely sure that HTTP is the protocol you want to use and you want to embrace it as an "Application" protocol, not just a "Transport" protocol then something like ASP.NET Web API.

    If you building a service for your servers in your datacenter to talk to each other then seriously consider WCF.

    Whether to do REST is a completely different question. Will this service last for many years? Will it have many different clients? Will some of those clients be out of your control? If you answered yes, then it may be worth investigating what benefits the REST constraints can bring.

    链接地址: http://www.djcxy.com/p/71382.html

    上一篇: 如何在JAX之间进行选择

    下一篇: 休息与Wcf的利弊