ServiceBehaviour attribute is used to specify the InstanceContextMode for the WCF Service class (This can be used to maintained a state of the service or a client too)

There are three instance Context Mode in the WFC

PerSession : This is used to create a new instance for a service and the same instance is used for all method for a particular client. (eg: State can be maintained per session by declaring a variable)

PerCall : This is used to create a new instance for every call from the client whether same client or different. (eg: No state can be maintained as every time a new instance of the service is created)

Single : This is used to create only one instance of the service and the same instance is used for all the client request. (eg: Global state can be maintained but this will be applicable for all clients)
SOA is Service Oriented Architecture. SOA service is the encapsulation of a high level business concept. A SOA service is composed of three parts.
1. A service class implementing the service to be provided.
2. An environment to host the service.
3. One or more endpoints to which clients will connect.

NOTE: This is objective type question, Please click question title for correct answer.
Windows Communication Foundation (WCF) is an SDK for developing and deploying services on Windows. WCF provides a runtime environment for services, enabling you to expose CLR types as services, and to consume other services as CLR types.

WCF is part of .NET 3.0 and requires .NET 2.0, so it can only run on systems that support it.

(content from another post: http://www.dotnetfunda.com/interview/exam283-what-is-wcf.aspx)

Web Services

1.It Can be accessed only over HTTP
2.It works in stateless environment

WCF


WCF is flexible because its services can be hosted in different types of applications. The following lists several common scenarios for hosting WCF services:
IIS
WAS
Self-hosting
Managed Windows Service

Self hosting the service in his own application domain. This we have already covered in the first section. The service comes in to existence when you create the object of ServiceHost class and the service closes when you call the Close of the ServiceHost class.
Host in application domain or process provided by IIS Server.
Host in Application domain and process provided by WAS (Windows Activation Service) Server.

Address --- Specifies the location of the service which will be like http://Myserver/MyService.Clients will use this location to communicate with our service.

Binding --- Specifies how the two paries will communicate in term of transport and encoding and protocols

Contract --- Specifies the interface between client and the server.It's a simple interface with some attribute.

Web services can only be invoked by HTTP (traditional webservice with .asmx). While WCF Service or a WCF component can be invoked by any protocol (like http, tcp etc.) and any transport type.

Second web services are not flexible. However, WCF Services are flexible. If you make a new version of the service then you need to just expose a new end. Therefore, services are agile and which is a very practical approach looking at the current business trends.

We develop WCF as contracts, interface, operations, and data contracts. As the developer we are more focused on the business logic services and need not worry about channel stack. WCF is a unified programming API for any kind of services so we create the service and use configuration information to set up the communication mechanism like HTTP/TCP/MSMQ etc

For more details, read http://msdn.microsoft.com/en-us/library/aa738737.aspx

• Self-hosting the service in his own application domain. This we have already covered in the first section. The service comes in to existence when you create the object of Service Host class and the service closes when you call the Close of the Service Host class.

• Host in application domain or process provided by IIS Server.

• Host in Application domain and process provided by WAS (Windows Activation Service) Server.

More details http://www.dotnetfunda.com/articles/article221.aspx#whatarethevariouswaysofhostingaWCFservice

WCF is a unification of .NET framework communication technologies which unites the following technologies:-

NET remoting
MSMQ
Web services
COM+
1. Service class
2. Hosting environment
3. End point

For more details read
 http://www.dotnetfunda.com/articles/article221.aspx#WhatarethemaincomponentsofWCF

Satya Chaitanya - Software Engineer
I am very much passionate about Microsoft technologies as I work as an asp.net developer, I am a Microsoft certified professional having 4 years experience in the various fields of software development life cycle, which includes technologies like Silverlight ,SharePoint Designer , SSRS.SQL Server, WCF, WPF And I am interested to share my knowledge, post articles on new technologies with the people.
http://chaitu.venkateswarlu.co.in
Read moreRead more about Contributor