WCF Data Services Question: Download WCF Data Services PDF

Can you explain how to define a service as REST based service in WCF?

Tweet Share WhatsApp

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.

Download WCF Data Services PDF Read All 26 WCF Data Services Questions
Previous QuestionNext Question
Do you know what is endpoint in WCF?Do you know what is the address formats of the WCF transport schemas?