none
WCF Rest Service RRS feed

  • Question

  • Hi,

    What the difference betwwen the wcf rest service and web api? When to choose to use the web api?

    Wednesday, April 29, 2015 3:08 PM

Answers

  • Hi Andrewsys,

    >>What the difference betwwen the wcf rest service and web api?

    For the difference betwwen the WCF Rest Service and Web API, please try to refer to the following information:

    WCF Rest Service:

    1. To use WCF as WCF Rest service you have to enable webHttpBindings.

    2. It support HTTP GET and POST verbs by [WebGet] and [WebInvoke] attributes respectively.

    3. To enable other HTTP verbs you have to do some configuration in IIS to accept request of that particular verb on .svc files

    4. Passing data through parameters using a WebGet needs configuration. The UriTemplate must be specified

    5. It support XML, JSON and ATOM data format.

    Web API:

    1. This is the new framework for building HTTP services with easy and simple way.

    2. Web API is open source an ideal platform for building REST-ful services over the .NET Framework.

    3. Unlike WCF Rest service, it use the full featues of HTTP (like URIs, request/response headers, caching, versioning, various content formats)

    4. It also supports the MVC features such as routing, controllers, action results, filter, model binders, IOC container or dependency injection, unit testing that makes it more simple and robust.

    5. It can be hosted with in the application or on IIS.

    6. It is light weight architecture and good for devices which have limited bandwidth like smart phones.

    7. Responses are formatted by Web API’s MediaTypeFormatter into JSON, XML or whatever format you want to add as a MediaTypeFormatter.


    >>When to choose to use the web api?

    • 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.

    For more information, please try to refer to the following articles:
    https://msdn.microsoft.com/en-us/library/jj823172(v=vs.110).aspx .
    http://www.dotnet-tricks.com/Tutorial/webapi/JI2X050413-Difference-between-WCF-and-Web-API-and-WCF-REST-and-Web-Service.html .
    http://blogs.msdn.com/b/fkaduk/archive/2014/01/07/rest-wcf-vs-webapi-throughput.aspx .

    Best Regards,
    Amy Peng


    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click HERE to participate the survey.


    Thursday, April 30, 2015 4:49 AM
    Moderator

All replies

  • Hi Andrewsys,

    >>What the difference betwwen the wcf rest service and web api?

    For the difference betwwen the WCF Rest Service and Web API, please try to refer to the following information:

    WCF Rest Service:

    1. To use WCF as WCF Rest service you have to enable webHttpBindings.

    2. It support HTTP GET and POST verbs by [WebGet] and [WebInvoke] attributes respectively.

    3. To enable other HTTP verbs you have to do some configuration in IIS to accept request of that particular verb on .svc files

    4. Passing data through parameters using a WebGet needs configuration. The UriTemplate must be specified

    5. It support XML, JSON and ATOM data format.

    Web API:

    1. This is the new framework for building HTTP services with easy and simple way.

    2. Web API is open source an ideal platform for building REST-ful services over the .NET Framework.

    3. Unlike WCF Rest service, it use the full featues of HTTP (like URIs, request/response headers, caching, versioning, various content formats)

    4. It also supports the MVC features such as routing, controllers, action results, filter, model binders, IOC container or dependency injection, unit testing that makes it more simple and robust.

    5. It can be hosted with in the application or on IIS.

    6. It is light weight architecture and good for devices which have limited bandwidth like smart phones.

    7. Responses are formatted by Web API’s MediaTypeFormatter into JSON, XML or whatever format you want to add as a MediaTypeFormatter.


    >>When to choose to use the web api?

    • 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.

    For more information, please try to refer to the following articles:
    https://msdn.microsoft.com/en-us/library/jj823172(v=vs.110).aspx .
    http://www.dotnet-tricks.com/Tutorial/webapi/JI2X050413-Difference-between-WCF-and-Web-API-and-WCF-REST-and-Web-Service.html .
    http://blogs.msdn.com/b/fkaduk/archive/2014/01/07/rest-wcf-vs-webapi-throughput.aspx .

    Best Regards,
    Amy Peng


    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click HERE to participate the survey.


    Thursday, April 30, 2015 4:49 AM
    Moderator
  • Thank you.
    Friday, May 1, 2015 2:03 AM