WCF In ASP.NET

By
In .NET Framework 1.0,It was very difficult to build application for facilitating   communication (messaging) between a server and client.There are several technologies used by the Microsoft but these are not enough use to provide clients service communication efficiently.
  1. Web services (.asmx)
  2. Web Service Enhancements (WSE)
  3. .NET Remoting
  4. Microsoft message queuing (MSMQ)
This  above protocols provided by the Microsoft to perform a client and server   communication (task ) in .NET Technology.
Note :- A Protocol is a set of rules.Means all the communication between client and server performed by the protocols in the universe. 
Problem in these protocols:- 
There are some problems in above protocols which is provided by the Microsoft company .
  •  It is confusing for the developers to select these technology as each of them is used to perform a different task.
  • If you want to connect each protocols to each other then developers were faced problem.Because each technology offer different functionality.So developers have to Knowledge in all technology.
How to solve these protocols problems:- Considering the difficulty of mastering each technology Microsoft introduced the Windows Communication Foundation (WCF) technology. WCF includes all these technologies functionality under a unified programming model,so that developers can easily make distributed application without any problem.But developers have to knowledge in WCF Technology.  

What is WCF :- 
WCF is a set of .NET Technologies that is used for creation and consumption of data services in a website.It helps the developers to build secure and reliable applications (websites).It Provides common platform for building service oriented application .

Advantage of WCF
The advantage of WCF over the previous technologies is that,it provides a common run time environment for the services.thereby, providing interoperability between services.

Architecture of WCF:-
The WCF architecture consists of various layers that help in developing distributed applications.The main architecture of WCF is shown in blew image:-


ARCHITECTURE

There are some layers in WCF Architecture.
  1. Contract layer
  2. Service Runtime layer
  3. Messaging layer
  4. Activation and Hosting Layer
     1. ) The Contract layer:- You already know ,Contract means a sort time agreement between two or more parties specifying the goods and services.
Contracts contain the details ,such as what task is to be done and how it is to be done. A WCF Contract layer performs the same functionality as we perform in our real world (real life).It is a binding between two machines that defines the terms and conditions for the message to be exchanged.
The Contract layer consists of the following components.
  • Data Contract:- A data contract is a formal agreement mode between a server and a client specifying the data that has to be exchanged between them.It helps serialization and de-serialization   of data after mapping CLR and xml schema  definitions (XSDs).
  • Message Contract:- A Message contract provides control over the simple object access protocol (SOAP).Message that are produced and consumed by WCF. It helps to direct access to the SOAP header and bodies to change the SOAP Message as for your requirement.The most important feature  of SOAP Message is interoperability.
  • Service Contract:-A service contract is a contract that defines the operations or methods available at end points .It also defines the message exchange pattern such as behavior of the message in one way,duplex or request/reply.
  • Policy Binding:- The Policy and Binding component of the contract layer specifies important information.Such as security and protocol of a WCF services. Binding is a process used to enable communication between services and clients.There are some protocols which are very necessary to communications with the end point of services.Ex HTTP,TCP,MSMQ.

     2. ) The Service Runtime layer:- The service runtime layer specifies and manage different behavior of a service that occur during its operation such as consuming  or hosting the services.There are some behavior managed by the service runtime layer.
  • Throttling behavior:- The number of processed messages varies according to demand of services.
  • Error Behavior:- It specifies the action to be taken, it only of the message give error during service runtime.
  • Instance behavior:-  It specifies the number of service instance that are available to process a message.
  • Meta Data Behavior:- It specifies ,meta data is available or not across the network.
  • Message Inspection:- It inspects all the message during service runtime.
  • Transaction behavior:- It roll backs the transactions, if any process fails during service runtime. 
  • Dispatch Behavior:- It determines ,how a message is handled and processed by the WCF infrastructure.
  • Concurrency behavior:- It specifies whether the message are processed sequentially or concurrently by the service.
  • Parameter filtering:- It filters the message header and executes preset actions.
     3. ) The Message layer:-The message layer specifies the pattern of exchanging data between channels that are used during service communication.
There are two types of channels used in WCF.

  1. Transport layer:- HTTP,Named pipes,TCP and MSMQ are used in transport layer.
  2. Protocol :- WS-Security and WS-Reliability are protocols that used in WCF Applications.
There are some functionality of protocols which are used in messaging layer in WCF.
  • Ws-Security Channel:- It enables .to secure the message by implementing the ws-security specification in the messaging layer of a service.
  • Ws-Reliable Messaging Channel:- This protocols gives guarantee to deliver the message over channels.
  • Encodes:- It provides the number of encodes for message.
  • HTTP Channel:- It specifies that HTTP is used for delivering a message.
  • TCP Channel:- It specifies that TCP is used for delivering the message.
  • Transaction flow Channel:- It define the pattern in which a message is transacted.
  • Named Pipe Channel:- It enables inter-process communication (IPC).
  • MSMQ Channel:- It enables services to inter-operate the MSMQ Applications.
     4. ) The Activation and Hosting layer:- The activation and hosting layer renders various options for the services in which they can be activated as well as hosted. we can host asp.net application services in two ways.
  • Self hosting (ex. window application,window service,console application.)
  • External server hosting (ex. IIS ,WAS)
The activation and hosting option provide by following layers.
  • Window Activation Service (WAS):-It enables WCF Application automatically activate when deployed on a computer that is running WAS.
  • Window Services:- It enables you to run WCF Service as windows services.
  • .EXE:- It enables you to run the WCF Services as executable files(.exe).
  • COM+:- It enables to run WCF Services as a COM+ application.
Features of WCF in .NET

There are some good features of  WCF in .NET which are given below:-
  • End point support
  • Enhanced transport layer
  • Queuing support
  • Improved security
  • Improved transaction process
  • Support for hosting WCF Service on various servers.
  • Ajax integration and java script object notation(JSON Support)
You can see difference between web services (.asmx) and WCF here.


For More....
  1. Form based authentication in asp.net
  2. Widows authentication in.NET 
  3. How to create constraints in ado.net application
  4. Application sate and Global.asax file
  5. How to implement cookie in asp.net
  6. Joins in sql server
  7. Web form controls in asp.net
  8. file handling real application in c#
  9. Reflection in c#
  10. Multi threading in c#

0 comments:

Post a comment

Powered by Blogger.