locked
Why we use web api restful service even we have wcf restful service? RRS feed

  • Question

  • User-1710838230 posted

    Dear All,

    Please give me some core difference on behalf we use web api restful service instead of wcf restful service and vice versa.

    Thanks and Best Regards,
    Farhat Ullah

    Thursday, June 15, 2017 6:13 AM

All replies

  • User-1509636757 posted

    Here is some explanation:

    • Choosing between WCF or Web API
      • Choose WCF when you want to create a service that should support special scenarios such as one way messaging, message queues, duplex communication etc.
      • Choose WCF when you want to create a service 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 transport channels are unavailable.
      • Choose Web API when you want to create a resource-oriented services over HTTP that can use the full features of HTTP (like URIs, request/response headers, caching, versioning, various content formats).
      • Choose Web API when you want to expose your service to a broad range of clients including browsers, mobiles, iPhone and tablets.

    Some reference link:

    Thursday, June 15, 2017 8:45 AM
  • User-1710838230 posted

    I have already read out these difference in internet but i want to some unique difference . Why we use web api when already wcf provide the same restful service?

    Thursday, June 15, 2017 9:00 AM
  • User-1509636757 posted

    You should refer the differences carefully. This is similar to evolution of any technology of software. Example, people were happy with WinXP and still Windows 10 is out and people are loving it. The particular section that describes when you should opt for restful WCF and when for Web API may clear out your doubt.

    Thursday, June 15, 2017 9:05 AM
  • User753101303 posted

    Hi,

    You also have https://docs.microsoft.com/en-us/dotnet/framework/wcf/wcf-and-aspnet-web-api

    ASP.NET web api is newer, lighter, based on controllers making it familiar to MVC users (and even merged with MVC in ASP.NET Core), can be updated out of band as needed etc...

    So it would be rather the other way round that is always try the simplest Web API option and switch to WCF only if you need something that web api doesn't offer.

    Thursday, June 15, 2017 9:46 AM