Home > SharePoint 2010, WCF > Deploy a Custom WCF into SharePoint2010—Part 1

Deploy a Custom WCF into SharePoint2010—Part 1

Deploy a Custom WCF into SharePoint2010—Part 1

Deploy a Custom WCF into SharePoint2010—Part 2

Deploy a Custom WCF into SharePoint2010—Part 3

Deploy a Custom WCF into SharePoint2010—Part 4

In SharePoint2010, it has lots of asp.net web services as well as some new WCF services to be used in your client application. The new client object model in SharePoint 2010 uses WCF as well. However, most of the built-in web services are generic and does not use your own business object. If you would like to have object that matches your own business scenario, you need to create your own WCF services. Today, I will show you how to create and deploy your custom WCF. You can download the source code here.

1. Create a new empty SharePoint project and deploy it as a farm solution.

2. Add 3 WCF Service Library projects into the solution as shown below. The reasons for this project setup are explained in a video screencast here.

3. In the YBBEST.WCFServiceImplementation project, add these YBBEST.WCFServiceContract and YBBEST.WCFDataContract project references.

4. In the YBBEST. WCFServiceContract project, add YBBEST.WCFDataContract project references.

5. Add the classes needed for the WCF project as below.

6. Add ISAPI SharePoint Mapped Folder to the YBBEST.CustomWCF SharePoint project, add YBBEST folder and in the folder add web.config file, add CustomService.svc file.

7. Add the following to your CustomService.svc(Add the 3 WCF Project references and the ServiceHost), to find the strong name of the project assembly , you can read my previous blog here.

8. Add the following to your web.config

9. Add the key from the YBBEST.CustomWCF project to the 3 WCF projects as a Link and sign the project using this key. For detailed explanation, please check MSDN article.

10. Add the project output dlls to the SharePoint Package for deployment into SharePoint.

a. Go to Package of the YBBEST.CustomWCF SharePoint project

b. Add Assembly from Project Output as below.

11. Deploy the project to your SharePoint server and navigate to the service url http://ybbest/_vti_bin/ybbest/CustomService.svc , you will find the following message, since I do not enable Metadata publishing for this service.

12. You need to change your web.config as follow to enable Metadata publishing for this service.

You can download the source code here.

About these ads
Categories: SharePoint 2010, WCF
  1. No comments yet.
  1. No trackbacks yet.

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

Follow

Get every new post delivered to your Inbox.

Join 163 other followers

%d bloggers like this: