Monday, February 1, 2010

Windows Communication Foundation

What is Windows Communication Foundation, WCF?

WCF helps in building applications to communicate with each other. It is a framework that helps in managing distributed computing. WCF has a layered architecture. It is a part of the .Net Framework 3.0

What are the components of WCF?

Components of WCF
1. Contracts and descriptions: - Describes different features of messaging. The features are described by Data contract, message contract, service contract and policy and binding.
2. End points or Service runtime: - This describes the actual behavior or operation of the service at runtime. The behaviors are identified by throttling behavior, error behavior, metadata behavior, instance behavior etc.
3. Messaging: - Processing and authentication of messages through channels takes place. Transport and protocol channels are used for the same.
4. Hosting environments: - Hosting environments like IIS, Windows services, consoles are used for hosting.

What is the difference between WCF and Web services?

WCF has a variety of distributed programming infrastructures. WCF offers more flexibility and portability. WCF has better security mechanisms as compared to Web services. Transportation is easier in WCF .

What is duplex contracts in WCF?

WCF allows duplex messaging pattern. Services can communicate with client through a callback. Duplex messaging in WCF can be done over different transports, like TCP, Named Pipes and even HTTP

What are different binding supported by WCF?

Different bindings
Built- in bindings and custom bindings. When the built in or system provided bindings are not suited for the requirement, custom bindings can be sued.
The system –Provided bindings are:
1. BasicHttpBinding:- uses HTTP for transport .
2. WSHttpBinding:- Used for non duplex services
3. WSDualHttpBinding:- Used for Duplex services
4. NetTcpBinding:- Used for cross machine communication
5. NetPeerTcpBinding:- Used for multiple machine communication
6. NetMsmqBinding:- queued binding Used for multiple machine communication

How do we use MSMQ binding in WCF?

Message queue allows applications running at different times to send and read messages from queues. WCF uses transactional queue to capture messages, delivered and stored. A non transactional queue can be used as well, though it does not guarantee the assurance of messages being transferred. netMsmqBinding defines a queued binding. This can be used for cross machine communication. Properties of netMsmqBinding allow sending and receiving of messages

Explain volatile queues and Dead letter queues.

WCF also uses non transactional queues for storing messages. Such queues are volatile in nature. They are stored in memory and not used in transactions. On shutting down the machine, the queue is lost. They don’t guarantee the transfer of messages.
Dead letter queues: - Dead letter queues are used for failed or dead messages. When a message delivery fails, it is stored in a dead letter queue. MSMQ has two types of dead letter queues recording failed messages for transactional systems and non transactional systems.

What are the various ways of hosting a WCF service?

Ways of hosting WCF Service
1. Self hosting: - The service code is embedded within the application code. An end point for the service is defined and an instance of SeriveHost is created. A method can be written then to call the service.
2. Managed Windows services: - here, some hosting code is written in the application code. It consists of registering the application domain as a windows service.
3. Internet Information Services: - Does not require any hosting code to be written in the application code. IIS host services can only use HTTP transport mechanism. IIS needs to be installed and configured on the server.
4. Windows process activation service:- Does not require any hosting code to be written in the application code. WAS needs to be installed and configured on the server. WCF uses the listener adapter interface to communicate activation requests. Requests are transported over non HTTP protocols.

Explain transactions in WCF.

Transactions in WCF allow several components to concurrently participate in an operation. Transactions are
a group of operations that are atomic, consistent, isolated and durable. WCF has features that allow distributed transactions. Application config file can be used for setting transaction timeouts.

What are the various programming approaches for WCF?

Programming approaches for WCF
Imperative: - Different programming languages can be sued for implementing service logic
Configuration based:- Config files can be used to accomplish a task and end points along with security settings
Attributes can be used for declaration for behaviors and contracts

What are the advantages of hosting WCF services in IIS?

Advantages of hosting WCF services in IIS
1. Provides process activation and recycling ability thereby increasing reliability
2. It is a simplified way of deployment and development of hosted services.
3. Hosting WCF services in IIS can take advantage of scalability and density features of ASP.NET

What are different isolation levels provided in WCF?

The different isolation levels:
1. READ UNCOMMITTED: - An uncommitted transaction can be read. This transaction can be rolled back later.
2. READ COMMITTED :- Will not read data of a transaction that has not been committed yet
3. REPEATABLE READ: - Locks placed on all data and another transaction cannot read.
4. SERIALIZABLE:- Does not allow other transactions to insert or update data until the transaction is complete.

0 Comments: