Table of Contents


If you're creating a WCF service you basically have two options:
  1. Create a WCF service in a SharePoint context.
  2. Create a separate WCF service.
If you're creating a WCF service in a SharePoint context, you're basically doing the following: you create a SharePointproject, add the WCF service and deploy it to the ISAPI folder. See: http://msdn.microsoft.com/en-us/library/ff521581.aspx for more info. Also, check out  http://cksdev.codeplex.com/, it contains a helpful WCF template.

If you're creating a separate WCF service,  you're basically creating a WCF project and publish the service. See http://sharepointdragons.com/2011/10/07/parallel-programming-in-sharepoint-2010-the-back-to-the-future-pattern/

So, when it comes to choosing one of the two scenarios, which one is best practice, and why?

Create a WCF service in a SharePoint context

 

Create a separate WCF service


If you do create a separate WCF service, it's best practice to run it in a separate (non-SharePoint) IIS web site. This way, you won't inherit the config settings of the SharePoint web application, which usually makes things a lot easier.

Inspired by forum discussion: http://social.technet.microsoft.com/Forums/en-US/sharepoint2010programming/thread/f3970114-9dab-45a4-a76a-e9458f57a463