WCF Interview Questions and Answers Part-1

Kailash Chandra Behera | Thursday, June 11, 2020
  1. What is WCF?

    WCF stands for Windows Communication Foundation and is an SDK provided by Microsoft for developing and deploying services on Windows. It is part of .NET 3.0 and requires .NET 2.0. WCF provides a runtime environment for services, enabling you to expose CLR types as services or to consume other services as CLR types.

    It is designed using service-oriented architecture principles to support distributed computing where services have remote consumers. Clients can consume multiple services and services can be consumed by multiple clients. Services are loosely coupled to each other.

  2. What is ABC in WCF?

    ABC in WCF is main building block of WCF service. A stands for Address, B for Binding and C for Contract.

    1. Address: - Specifies the location of service.
    2. Binding: - Specifies how to communicate with service.
    3. Contract: - Specifies interfaces between client and service.

  3. What is Address in WCF?

    Address is the URL that defines location of service. Address is a way of letting client know that where a service is located. in WCF, every service associated with a unique address. This contains the location of the service and transport schemas.

  4. What is Binding?

    A binding defines how an endpoint communicates to the world. A binding defines transport such as HTTP or TCP and encoding being used such as text or binary. A binding also contains binding elements that specify security mechanisms used to secure messages.

  5. How many types of bindings WCF supports?

    Default WCF support 10 type of bindings, you can define your own custom bindings.

  6. What is Contract?
  7. A WCF contract defines what a service does or what action a client can perform in the service. The contract is one of the elements of a WCF endpoint that contains information about the WCF service. The contract also helps to serialize service information.

  8. How many types of contract available in WCF?
  9. There are four type of contracts in WCF that are

    1. Service Contract
    2. Data Contract
    3. Fault Contract
    4. Message Contract

  10. What is Service Contract
  11. The Service Contracts describes what action a client can perform in a service. This attribute is in the System.ServiceModel namespace. There are the following two types.

    1. Service Contract
    2. Operation Contract

  12. What is Data Contract
  13. A Data Contract defines what data type to be passed to or from the client. In the WCF service, the Data Contract takes a major role for serialization and deserialization. There are two types of Data Contracts.

    1. Data Contract
    2. Data Member

  14. What is Fault Contract
  15. Fault contract is only the way to expose the exceptions occured in service to client. Means the fault contract defines the error to be raised by the service and how the service handles and propagates the error to its clients.

  16. What is Endpoint?
  17. WCF Endpoint contain the details of the WCF service, like where the service resides (address), how to access it and what the WCF service exposes to the client. Every service must have an address defining the service's residence, a binding that defines how a client to communicates with the service and a contract that defines what the service does. The combination of Address, Contract and Binding is called an endpoint. The elements of an endpoint are called A, B and C as in the following.

Related Articles

  1. WCF Interview Questions and Answers Part-2
  2. OOPS Interview Questions
  3. Threading Interview Questions
  4. SQL Interview Questions and Answers
  5. SQL Interview Questions and Answers Part-2