1.What is WCF ?
Windows Communication Foundation is a framework for building Service
Oriented Application(SOA).It was introduced in .Net Framework 3.0 and is
basically a combined feature of WebService,Remoting,MSMQ and COM+.

2. Difference between Webservice and WCF ?
->WebService cab be  hosted only in IIS 
WCF can be hosted in IIS,windows Service,Self hosting and windows
activation service.
->WebService can be accessed only through http protocol. WCF cab be accessed through http,tcp,MSMQ and named pipes.
->WebService works in stateless env. WCF can maintain  states and sessions.
->Webservice uses System.Xml.serialization name space for serialization. WCF uses System.Runtime.Serialization namespace  for serialization

3.What is .svc file? 
Its the file where service is defined and it will be the point of contact from 
the consumers.It contains name of service and code behind file name.It is used to know about the service.

4.What are different ways in which WCF can be hosted ?
The different hosting techniques are
1.IIS hosting--This is the most commonly used hosting technique.Here IIS is
used as a  server and has following 
advantages -> starts automatically on the first client  request,process recyling.
Disadvantage-- It supports only http protocol

2.Self hosting-This is hosting the WCF  urself either in console/windows 
application also  in windows service .
  • The host process  should be running before a client makes a call to servc.
  •  Its easier to debug and deploy.
  •  Lifetime of services can be controlled using Open and Close methods.
3. WAS hosting(Windows Activation Server hosting)--WAS was introduced
with windows  vista and it is shipped with IIS 7.0. it is more powerful than
IIS 6.0 as it can support  http,tcp and named pipes whereas IIS 6.0 can 
support only http. 

4.Windows Service Hosting--Here the service can be programmed to start 
when the system starts.

5.What do you mean by ABC in WCF ?
ABC in WCF means -
Address ->  A stands for Address. It indicates where you service is located.A URL is used to point to the location.Depending on whethere the service is hosted in http,tcp... the address varies. eg-

Binding ->B stands for Binding which specifies how the client should communicate with the service.

Contract->C stands for contracts. It exposes the operation provided by the Service. It is a  contract.

6.What is an endpoint in WCF ? 
ABC together constitute an endpoint.Endpoint provides the client access to the functionality exposed by the service.
7.What do you mean by contarcts. What are the different types of contracts ? 
Contracts are  standard way of describing the operations performed by a Service.Diff types of contracts are--

1.Service Contracts 
It describes the operations provided by the service.WCF service  
should have atleast one ServiceContract.it has two attribute-
[ServiceContract] --Used to define the interface.Client can talk to services via interfaces.
Similar to [Webservice] attribute in Webservice
[OperationContract]-Used to define methods inside the interface.Similar to 
                 public interface ISimpleCalculator
                    int Add(int a, int b);
2. DataContract
 This defines the data which is exchanged between the client and the service.
 these are used manily for used defined objects.They are of two types
 [DataContract]--defines the class
 [DataMember] --defines the properties.
 class Name
      public string Fullname; 
       public string FirstName;
       public string SurName;

Inbuilt types like string (Fullname) are defined impicitly and they do not need
data contracts.
3.Fault Contracts.   
These are used to handle errors in a service.When a service throws an error it
does not reach the client side.  But by using fault contract we can come to know the
error that is raised by the service.
    public interface ISimpleCalculator
        int Add(int a, int b);
Raise the exception as
throw new FaultException("error") ;

4.Message Contracts
Message Contract defines the way messages are transferred  using SOAP messages. It
is used if you want to customize the SOAP format.
public class CustomerDetails
    public string CustID;
    public string Name;

8.Whats the diff between Message Contract and Data Contract.
Data contracts are used to describe data types used by service.They can be either parameter or return type.
Message Contract are used to describe SOAP message format.They allow us to cotnrol the detail is SOAP header and body.

9.What namespace is used to access WCF ?

10.What are the main components of WCF?
1.Service Class--functional class using any .net language.
2.Hosting environment--IIS,windows service etc

11.what is proxy in WCF?   
A proxy is a class by which a service client can Interact with the service.By the use of proxy in the client application we can call different methods in the service.

12.What are two method in which you can access WCF?
By Adding it as reference -- this will automatically generate the channel required for you to communicate with WCF.
By creating channel manullay- use ChannelFactory.
however the second method should be preferred one as pointed out in below article

13.How do you achieve method overloading in WCF?
By making use of name property in OperationContract
interface ISimpleCalculator
 int Add(int a,int b)

 int Add(double a,double b)
14.Why normal method overloading is not possible in WCF ?
Because WSDL is not a OO language and it does not support OOPs concept.

15. How do you host a webservice in windows service?


16.simple eg for using channel factory.




  1. Thanks a lot for such informative questions and answers.

  2. Very Nice Questions and Answers....

  3. Good collection.The answers are clear and simple to understand.Nice one!!

  4. Very good stuff and Excellent!!

  5. Dealer's Choice provides various services to the automotive industry that are designed to make the business process more efficient and streamlinedService ContractsOur mission is to reduce the cost of operations for dealerships and increase their productivity with tools that give customer satisfaction a new meaning.

  6. This comment has been removed by the author.

  7. Great knowledge I got from this post and very informative points you have shared here, Inmotion Review

  8. Best Blog Ever !! For CSharp and Dot Net .

    Game Developers pm me .

  9. "Great blog created by you. I read your blog, its best and useful information. You have done a great work. Super blogging and keep it up.php jobs in hyderabad.

  10. I really impressed for this blog because it has good content for learners. check it once now Angularjs Online Training

  11. • Nice and good article. It is very useful for me to learn and understand easily. Thanks for sharing your valuable information and time. Please keep updatingAzure Online course

  12. I have read your blog it is very helpful for me. I want to say thanks to you. I have bookmark your site for future updates.