I have toyed with blogging for a while now. A lot of my peers have blogged at some time in their careers. Most I know lost interest and haven’t posted anything new in months, if not years. My intent is that topics I post will do one of two things, either provide a solution to something I spent some time trying to figure out that should have been obvious, or provide information about new often overlooked technologies that I expect will be useful if not critical to know and learn.
To get things started if you haven’t been actively doing everything in your power to know about WCF then it’s about time to start. Too many of my peers have glanced over WCF and really don’t understand its full capabilities for developing solutions. Did you know WCF can handle TCP, Named Pipes, HTTP, MSMQ, WS*, and WS Dual Http (That’s right bidirectional communication over HTTP!) right out of the gate? That means instead of having to know the System.Net.Sockets, the System.Messaging, the System.Web.Services, and System.IO.Pipes assemblies you can just learn WCF!
I’ll be elaborating on WCF in coming posts. WCF and Ajax using JSON is a great topic for web development and I have discovered some interesting gotchas that need a deeper dive. For now I will end with the following statements, if you are using Web Services and the [WebMethodAttribute] attribute to declare your service methods you are losing out on all that WCF could provide. You can create Web Services that generates a WSDL definition, uses SOAP, and can return JSON and any web service client can connect to them. In addition you should never need to create a client Web Service Reference using "Add Web Service" from Visual Studio again! Instead use the "Add Service Reference" and point it to the Web Service location and you have the exact same behavior you want, except you are using WCF.
If you remember anything from this post WCF replaces Web Services using the BasicHttpBinding. It still runs just like a Web Service but now you have the means to offer up your service in other ways without code changes. If your service needs to be consumed by clients within your network now you can expose a net.tcp endpoint with Zero changes to your code. The TCP binding will do a binary serialization of the messages reducing its size considerably from its full SOAP/XML format. Simply by using WCF you have many robust options available to you as the demands of your service grows, if the demands remain unchanged no worries you still have a simple Web Service but only a single expertise set needed to support it, WCF.