Hosting WCF in SharePoint

I was starting to write some demos on how to host WCF in SharePoint, and ran into some odd problems.  I kept getting a System.ArgumentException, pointing to a parameter called "virtualPath".  I fought it only for a little while and decided to see if anyone had hit the same issue.  Turns out Sahil Malik did and wrote a great blog series on how to host WCF in SharePoint.

To host WCF in SharePoint:

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.

[via https://blah.winsmarts.com/2008-5-SharePoint_2007_as_a_WCF_host_-_Step_-1,_make_a_WCF_Home.aspx]