Here is a sample project which will show you how to send and receive JSON data from a WCF service using three of the most popular javascript libraries. You can do it without the libraries but why reinvent the wheel. Also, this is actually a VS2008 Studio Template so just download and drop the file into My Documents\Visual Studio 2008\Templates\ProjectTemplates\Visual C#\ and enjoy.
To use the template, goto File\New Project\Visual C# and look to “My Templates” and you should see WCF JSON.
wcf-json Visual Studio 2008 Template
Programming
C#, JSON, Visual Studio 2008, WCF
I’ve been doing a bit of WCF lately and picked up on a few things that will be helpful for me to remember. To speed large transfers switch the messageEncoding on the binding to be MTOM, otherwise your data will get base64 encoded inside the XML.
- Streaming requires a MessageContract and not a DataContract
- Streaming doesn’t work on wsHTTPbinding.
- A MessageContract can only have one Member in the body (stream).
Another good piece:
http://www.aspfree.com/c/a/Windows-Scripting/WCF-and-Hosting/3/
Programming
.NET, MessageContract, MTOM, WCF
When you install visual studio 2008 along side Visual Source Safe 2005 you will need this update to enable the Open from Source Safe option from within visual studio.
http://msdn.microsoft.com/en-us/library/ms181038(VS.80).aspx
Programming, Tips and Tricks
Visual Source Safe, VS 2008