Creating JSON-enabled WCF services in .NET 3.5
Updated: A even simpler approach by the author. WCF 3.5 supports an even simpler model for building script services than the approach I outlined – by setting Factory=”System.ServiceModel.Activation.WebScriptServiceHostFactory” in your .svc file, you can completely remove all configuration file settings. In fact, you can reduce the entire service to a single file if you like by embedding the service class directly in the .svc file
Just over a year ago, I wrote an article for MSDN Magazine detailing how to make client-side web service calls with the ASP.NET Ajax extensions to .asmx web services. While most of the contents of that article still apply today to .NET 3.5 and Visual Studio 2008, there is a fundamental shift going on away from .asmx and towards .svc (WCF) for web services, so I thought it would be timely to post an update to that article to describe how to use WCF for your script-callable web services in .NET 3.5.
My goal with this post is to provide very specific and easy to follow instructions on how to create script enabled WCF services with the final release of Visual Studio 2008 and .NET 3.5.
The simplest way to create an Ajax-enabled WCF endpoint is to use the new Visual Studio 2008 Ajax-enabled WCF Service item template. You can also script-enable an existing WCF service, but to keep this streamlined, we’ll start with this template.
No comments yet.
