[How To]:Converting a WCF Service to REST Enabled – Part 1

Below are the steps to convert make the service REST enabled :

Step 1 :

In IserviceRequestManager.cs, replace the [Operation Contract] with [WebGet] and add reference “System.ServiceModel.Web”

Step 2 :

In ServiceRequestManager.svc markup, add the attribute “Factory=”System.ServiceModel.Activation.WebServiceHostFactory”.

As shown below :

<%@
ServiceHost
Language=”C#”
Debug=”true”
Service=”XYZ.ServiceManagement.Services.ServiceRequestManager”
CodeBehind=”ServiceRequestManager.svc.cs”
Factory=”System.ServiceModel.Activation.WebServiceHostFactory”
%>

Step 3 :

In web.config within the <system.ServiceModel> add the following configuration :

“<standardEndpoints>
<webHttpEndpoint>
<!– the “” standard endpoint is used by WebServiceHost for auto creating a web endpoint. –>
<standardEndpoint name=”” helpEnabled=”true”/>
</webHttpEndpoint>
</standardEndpoints>”

As shown below :

Happy Exploring J

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s