Prior to .Net 3.0 it was not an easy matter to select a particular technology for communicating between systems due to the number of technologies available from Microsoft. For example, users could have used Web Service to communicate between a Java based application and a .Net application; WSE users could have take advantage of some of the WS-* message protocols; MSMQ has the ability to queue messages which helps to communicate between intermittently connected solutions; Enterprise services (the successor of COM+) helps to build distributed application easily; .Net Remoting is a fast way to move messages between two .Net applications. All the above mentioned technologies have their pros and cons. Using WCF now we can take the advantage of all the above distributed technologies in a unified manner and WCF is the successor to all these message distribution technologies.
Performance comparison between distributed technologies:
When we migrate distributed applications made with ASP.NET Web Services, WSE, .NET Enterprise Services and .NET Remoting to WCF, it will in almost all cases result in a performance boost:
Other Distributed Technologies
WCF Performance Advantage
ASP.NET Web Service
WSE 2.0/3.0 implementations.
.NET Enterprise Service
100% faster subject to the load.
Whereas the other Microsoft distributed technologies do not have too many limitations in running on Windows operating system, an application built with WCF can run only on Windows XP SP2, Windows Vista or Windows Server 2008.
A WCF service is made up of three parts: the service, one or more endpoints and a hosting environment.
A service is basically a class written in a .Net compliant language which contains some methods that are exposed through the WCF service. A service may have one or more endpoints – an endpoint is responsible for communication from the service to the client.
Endpoints also have three parts which are known as ‘ABC’: ‘A’ for Address, ‘B’ for Binding and ‘C’ for Contracts.
Ø Address: Address specifies the info about where to find the service.
Ø Binding: Binding specifies the info for how to interact with the service.
Ø Contracts: Contracts specifies the info for how the service is implemented and what it offers.
Finally a hosting environment where the service is contained.
System-provided WCF bindings are used to specify the transport protocols, encoding, and security details required for clients and services to communicate with each other. As per MSDN followings are the system-provided WCF bindings:
A binding that is suitable for communication with WS-Basic Profile conformant Web Services like ASMX-based services. This binding uses HTTP as the transport and Text/XML as the message encoding.
A secure and interoperable binding that is suitable for non-duplex service contracts.
A secure and interoperable binding that is suitable for duplex service contracts or communication through SOAP intermediaries.
A secure and interoperable binding that supports the WS-Federation protocol, enabling organizations that are in a federation to efficiently authenticate and authorize users.
A secure and optimized binding suitable for cross-machine communication between WCF applications
A secure, reliable, optimized binding that is suitable for on-machine communication between WCF applications.
A queued binding that is suitable for cross-machine communication between WCF applications.
Ø NetPeerTcpBinding :
A binding that enables secure, multi-machine communication.
Ø MsmqIntegrationBinding :
Ø MsmqIntegrationBinding: A binding that is suitable for cross-machine communication between a WCF application and existing MSMQ applications.
It should be noted that WCF also allows us to define our own custom bindings.
Creating a WCF service:
In order to create a WCF service in Visual Studio, select WCF>WCF Service Library from the New Project dialog.
This will create the several files in a new project. Apart from the AppConfig file there are two more files – Service1.cs and IService1.cs . Service1.cs is an implementation of the IService1.cs interface.
Pages: 1 2