Search code examples
wcfwcf-rest

Implementing REST in WCF


I have a existing WCF in .NET which is consumed through wsdl and proxy classes. Soon, there will be multiple consumers and the load on the WCF will be pretty high. I was asked to develop a new WCF with REST which can be beneficial interms of performance. I don't have much knowledge on REST, hence can you please let me know whether implementing a RESTFUL WCF will improve the performance drastically? Please provide me any links to implement the same.

Thanks in advance, Vinoth Khanna.S


Solution

  • You can also use WCF Data Services to easily offer a REST interface to your data.

    The easiest way is to build an Entity Framework model of your data and then to expose that model as a WCF Data Service. This then exposes all data using the OData protocol, which is REST + AtomPub.

    And Kiran is of course right, REST by itself does not increase performance. I assume that you want your UI to access the REST service directly rather than go through a web service which contains hand-written methods to read and write data. In that case, there may be some performance gain, but I wouldn't count on it much.

    See also:

    http://msdn.microsoft.com/en-us/library/cc668794.aspx

    and

    http://en.wikipedia.org/wiki/WCF_Data_Services

    If you want to return results as JSON, the easiest way to get that to work is by adding the WCF Data Services Toolkit:

    http://wcfdstoolkit.codeplex.com/