How to define a service as REST based service in WCF?

 Posted by Poster on 11/18/2008 | Category: WCF Interview questions | Views: 13057
Answer:

WCF 3.5 provides explicit support for RESTful communication using a new binding named WebHttpBinding.
The below code shows how to expose a RESTful service

[ServiceContract]

interface IStock
{
[OperationContract]
[WebGet]
int GetStock(string StockId);
}


By adding the WebGetAttribute, we can define a service as REST based service that can be accessible using HTTP GET operation.


Source: http://weblogs.asp.net/shijuvarghese/archive/2008/04/04/rest-and-wcf-3-5.aspx | Asked In: Many Interviews | Alert Moderator 

Comments or Responses

Login to post response