Deploy and Consume Sharepoint 2010 hosted WCF Service - Part 2

Welcome back, I talked about how to create a HTTPS enable Sharepoint site in the 1st Part of this post series. You can find it here.

1. Create SharePoint WCF in Visual Studio 2010

1.1 Go to Visual studio Go to new project and Select empty Sharepoint 2010 Project.

1.2  Then it will ask you to select a Sharepoint site which you wanna host this Sharepoint Project. so give your Sharepoint site and Check on Deploy as Farm Solution

1.3 Now it's time to add your WCF component to your project. by default you cannot directly add a WCF component to your project. so Here I'm going to use CKS Dev component to do that. 

1.4 Go to menu bar and select tool. then select on Extenstion manager to Add CKS Dev tool. Search for CKS Dev on online Gallery and Install CKS Dev server component.

1.5 Once you install CKS dev re-start your Visual studio and now you can add WCF components to your solution easily. Select your Project and select on add new Item and select WCF service. Then add it to your project. 



1.6 Now your project sttructure is look like below


1.7 I'm not going to change the service implementation of the project. but before deploy this solution we need to do some change to the WCFService1.svc. click on WCFService1.svc and you will see something like this inside it.


1.8 Now we need to change the value of "$SharePoint.Project.AssemblyFullname$" for that we can use different approches but here i'm going to use following approch in here. and add that generated full name above mention value. 

1.9 Ok now it's time to deploy the Solution to your sharepoint project. before do the deployment let's check again about sharepoint URL is correct or not. select your sharepoint project and press F4 to get project property window. check the URL is correct or not. 




1.10 If all settings are correct then right click on and select deploy. and you are done with the deployment. (cheers) 




1.11 By defaul CKS Dev WCF service will deploy into SharePoint _vti_bin. so go to your following url to check your service mex end point to whether service is working or not 

Note -  https://<Your-site>/_vti_bin/<service-name>.svc/mex



1.12 If you followed given steps then your WCF is already hosted in Sharepoint site. from next post I'll explain how to consume this service from C# console application or Sharepoint webpart. still then cheers to all you. 





Comments

  1. Good one, very useful for those who are working on hosting a WCF service in Sharepoint environment for the first time!

    ReplyDelete

Post a Comment

Popular posts from this blog

Deep dive into OpenXML Part 1

Deep dive into OpenXML Part 2

Convert XML data to dynamic (ExpandoObject) Object