Skip to main content

WCF – How to Host a custom WCF service in SharePoint

Recently I had to write a Custom WCF Service in SharePoint 2013 to expose the employee related data. You may be surprised to see how quickly it can be done on SharePoint, these are the basic steps you need to follow to get it working.
Step#1
Create an Empty SharePoint 2013 Solution
spwcf1
Step#2
Enter the URL of a Site Collection and select Farm Solution
spwcf2

Step#3
Add the following References on the Add Reference
spwcf3
Step#4
Create the Required Domain Objects
spwcf6
Step#5
Create the Required Service Interface
spwcf7
Step#6
Create the Required Service Class
spwcf11
Step#7
Add Layouts folder to the solution
spwcf4
Step#8
Since we cannot add a svc file directly, add a text file and rename it to .SVC
spwcf5
Step#9
Prepare the .Svc
spwcf12
Step#10
Select the Project and go to Properties. Modify the Deployment Target Property as WebApplication
spwcf10
Step#11
Deploy the solution and test from the Browser by giving the following url

Comments

Popular Posts