Previously WCF was knows Indigo service and later on with .Net Framework its knows as WCF, WCF was first introduced with .Net Framework 3.0 in 2006 later on its become the most popular programming language for network distributed application because it provides all combined features of Web service, Remoting, MSMQ and com+ on single platform without using different service for different requirement.
Let us understand with following Diagram
From above diagram, I am trying to give you message that WCF is the common technology to provide the feature of all technologies being used to communicate for different purposes.
This is normal communication of Web service and client in which client requirement is to exchange the data using HTTP Protocol.
In the above example Web service communicate with client using HTPP protocol and only HTTP protocol supports web service and suppose in future client wants to exchange data using TCP as wel as HTTP without creating a separate service then with Web service its not possible ,we can achieve it by using WCF service.
from the above diagram i am trying to explain that WCF Service can exchange data or message in any format that is SOAP,Binary using wide range of communication protocol such as HTTP ,TCP and so on.
- Service Run time.
- Activation and Hosting .
Contracts in WCF
- Service contracts
- Data contracts
- Message contracts
- Fault Contract
- Operation contract
- Policies and Binding
It can be defined as
In order to support interoperability and client will also be interested only, what went wrong? Not on how and where cause the error.
The following is the syntax to raise the custom error in WCF
It can be defined as
- Throttling Behavior
- Error Behavior
- Metadata Behavior
- Instance Behavior
- Transaction Behavior
- Dispatch Behavior
- Concurrency Behavior
- Parameter filtering
- Message inspection
- Throttling Behavior- Controls how many messages are processed.
- Error Behavior - Specifies what occurs, when internal error occurs on the service.
- Metadata Behavior - Tells how and whether metadata is available to outside world.
- Instance Behavior - Specifies how many instance of the service has to be created while running.
- Transaction Behavior - Enables the rollback of transacted operations if a failure occurs.
- Dispatch Behavior - Controls how a message is processed by the WCF Infrastructure.
- Concurrency Behavior-Its used to control how many threads can access a given instance of service.
- Parameter filtering-It filters the message headers and executes preset actions based on the filters of the message headers.
- Message inspection-Its used to inspect specific part or all parts of the message through service.
- Transport Channels
- Protocol Channels
Activation and Hosting in WCF
Internet information Service provides number of advantages if a Service uses Http as protocol. It does not require Host code to activate the service, it automatically activates service code.
Windows Activation Service
(WAS) is the new process activation mechanism that ships with IIS 7.0. In addition to HTTP based communication, WCF can also use WAS to provide message-based activation over other protocols, such as TCP and named pipes.
WCF service can be self hosted as console application, Win Forms or WPF application with graphical UI.
WCF can also be hosted as a Windows Service, so that it is under control of the Service Control Manager (SCM)
- Support for different protocol
- Security over transport as well as Message level
- Easy to implement MSMQ and REST Service.
- Load balancing & support scaling.
- It can control concurrency.
- It can be hosted on IIS, WAS, Self hosting, Windows services.
- Multiple Message Patterns.
- Unhanded Exceptions does not return to the client as SOAP faults. WCF supports better exception handling by using Fault Contract.
Please refer my following articles for complete understanding