SharePoint as a WCF Host

Posted on 9/8/2008 @ 9:14 PM in #SharePoint by | Feedback | 9564 views

This is one of those occasions where I wished I had multiple categories enabled on my blog :-). Anyway, I wrote this blog engine, and I have limited time to enhance this, so I'll live with what I have for now, and categorize this under SharePoint.

So the 20cent question is - Can SharePoint 2007 host WCF services? The answer is - Yes! But it takes some findiggling.

But first of all, why the heck would you want SharePoint to be a WCF host? For two reasons:

a) SharePoint comes with a very rich object model, and the out of the box web services are somewhat limited on the functionality they expose.

b) WCF comes with all the WCF advantages. Now it becomes so much easier to tie SharePoint into another system over MSMQ, a different security model, etc. (No it still can't do transactions though - nice try!).

Okay so, lets get started.

In order to make SharePoint work as a WCF host, you need to perform the following steps:  

Table of Contents for SharePoint as a WCF host

- Basics -

1. Create a WCF Home. This is the virtual directory that will host all your WCF endpoints.

2. Create a WCF Service Library, and throw it in the GAC.

3. Create a relevant .svc file in the WCF home you created in step #1.

4. Write a WCF Virtual Path Provider, and register it in the SharePoint site.


- Real world -

1. Adding WCF Support to a website.

2. Deploying WCF EndPoints as solutions.

Sound off but keep it civil:

Older comments..

On 11/6/2008 4:58:24 AM Kiteboardertje said ..

i made use of your blog to make a silverlight application in sharepoint with wcf

On 12/3/2008 8:15:28 AM Garth said ..
Pinging back: I put a sample web.config file for wcf as I had some issues with this.

Thanks for this series.

On 8/31/2009 4:37:08 PM Rene Windegger said ..

fixed a strange problem with the AesCryptoServiceProvider with support of your post.

On 5/18/2010 2:26:47 PM Marc Bellario said ..
very nice and to the point, just what I was looking for,

great effort, thanks