CKS and WCF Services

Feb 2, 2011 at 6:53 PM
Edited Feb 2, 2011 at 9:46 PM

I am not sure if this is a bug but what I am sure is adding a WCF service with CKS and making it talk nicely with jQuery is my tonight's nightmare. 

Here are the steps to reproduce: Add a CKS WCF service to your SharePoint project, then open the svc file and change the factory class from MultipleBaseAddressBasicHttpBindingServiceHostFactory to MultipleBaseAddressWebServiceHostFactory to enable Ajax style calls and Json. Add WebGet attribute to operation contracts and specify UriTemplates. Try to run it and bam! It doesn't work. I don't know if CKS is adding some configuration behind but looked everywhere and didn't see any. After all it shouldn't add any otherwise what's the point of using service factories?

Here is my solution: Don't use CKS Wcf service option if you want to use WebGet calls. Add your svc files to SharePoint mapped _layouts folder and let Visual Studio deploy it to SharePoint. This way it works.

This took my hours to figure out, and still don't know what is the secret behind the CKS option. Any explanation is appreciated.

Feb 2, 2011 at 10:37 PM
This discussion has been copied to a work item. Click here to go to the work item and continue the discussion.