Thank you everyone for all your support so far. In our last post, we covered how and why to use NuGet, NPM and Bower. In this post, we will take a look at the basics of WCF.
Introduction
WCF was first introduced in .NET Framework 3.0 and became very popular with .NET developers over the years. It was designed for building distributed systems, but we already had many systems before WCF to achieve the same, to point few of them:
- DCOM: used before .NET came into existence.
- MSMQ: used to deliver the message in distributed system. It was first shipped in C-based API, available in .ne as well.
- Web Services: Most of the developers are aware of this, and still asked in interviews, before WCF it was the darling for most of the systems, reason being XML format, and can be understood by other languages such as Java, PHP, JavaScript and many more.
But web services has its own disadvantages as well, it works perfectly over HTTP, but there might be some requirement where you want to use it within your network over some reliable protocol like TCP. Also, when web services were introduced, all big companies like (Microsoft, IBM and Sun Microsystes) started writing their version of it and they were not compatible with each other. To avoid this, W3C and WS-I came into existence, which later became the WS*- specifications.
WCF Features
- Support for strongly typed and untyped messages. Strongly typed means you can create your own classes in .NET and another .NET can use it, and other languages like Java can still use XML.
- Support for several binding like (HTTP, TCP, MSMQ and named pipes) allows us to choose best transport protocol.
- Support for latest WS-* specifications.
- Support for session-like state management techniques, as well as support for one way or stateless messages.
Now let's see the core assemblies and namespaces which are used for WCF.
- Core WCF Assemblies
- System.Runtime.Serialization.dll: This assembly defines namespaces which we can use for serializing and deserializing objects in WCF.
- System.ServiceModel.dll: This core assembly contains the types used to create a WCF application.
- Core WCF Namespaces
System.Runtime.Serialization
: This defines many types which can be used to control how data is serialzed and deserialized in WCF. System.ServiceModel
: This namespace defines binding and hosting types, as well as security and transactional types.. System.ServiceModel.Configuration
: This type provide programmatic access to WCF config files. System.ServiceModel.Description
: This provides an object model to the addresses, bindings and contracts defined within WCF. System.ServiceModel.MsmqIntegration
: This is used for integration with MSMQ. System.ServiceModel.Security
: Defines numerous types to control aspects of the WCF security layers.
We know the DLLs and classes which are driving our WCF services, let’s see the other aspects of WCF.
ABCs of WCF
Host and client interact with each other by agreeing upon ABCs. Let’s see what those are.
- Address: Describes the location of the service
- Binding: How you are going to exchange data between host and client
- Contract: What type of data is going to be transferred
We will create a WCF service in our next blog, now we know the purpose of WCF services and core things about WCF. WCF works on SOA (Service Oriented Architecture), so our application will have a service and client to consume the services.
Conclusion
Unlike Web services, WCF gives us much more flexibility over choosing the protocol, more security and many advantages which we will cover in upcoming blogs.
You can follow my official Facebook page, and you can also subscribe to my blog for more information.
You can also mail me on santosh.yadav19613@gmail.com in case you have any questions.