What Message Exchange Patterns (MEPs) supported by WCF?

Three MEP supported by WCF.
1. Request/Response
2. One Way
3. Duplex


It’s the default pattern. In this pattern, a response message will always be generated to consumer when the operation is called, even with the void return type. In this scenario, response will have empty SOAP body.

One Way

In some cases, we are interested to send a message to service in order to execute certain business functionality but not interested in receiving anything back. OneWay MEP will work in such scenarios. If we want queued message delivery, OneWay is the only available option.


The Duplex MEP is basically a two-way message channel. In some cases, we want to send a message to service to initiate some longer-running processing and require a notification back from service in order to confirm that the requested process has been completed.

How we can achieve Operation Overloading while exposing WCF Services?

By default, WSDL doesn’t support operation overloading. Overloading behavior can be achieved by using “Name” property of OperationContract attribute.

interface IMyCalc
[OperationContract(Name = "SumInt")]
int Sum(int arg1,int arg2);

[OperationContract(Name = "SumDouble")]
double Sum(double arg1,double arg2);

When the proxy will be generated for these operations, it will have 2 methods with different names i.e. SumInt and SumDouble.

What are the possible ways of hosting a WCF service?

To host WCF service, you need at least a managed process, a ServiceHost instance and an Endpoint configured.

Possible approaches for hosting a service are:

  • Hosting in a Managed Application/ Self Hosting
  1. Console Application
  2. Windows Application
  3. Windows Service
  • Hosting on Web Server
  1. IIS 6.0 ( ASP.NET application supports only HTTP )
  2. Windows Process Activation Service (WAS) i.e. IIS 7.0 supports HTTP, TCP/IP, NamedPipes, MSMQ

What are WCF Service End points?

For WCF services to be consumed, than it must be exposed; Clients need information about service to communicate with it. This is where service endpoints play their role.

WCF service endpoint has three basic elements i.e. Address, Binding and Contract.

  • Address: It defines “WHERE”. Address is the URL that identifies the location of the service.
  • Binding: It defines “HOW”. Binding defines how the service can be accessed.
  • Contract: It defines “WHAT”. Contract identifies what is exposed by the service.

What is the difference between WCF and ASMX Web Services?

Basic difference between ASMX or ASP.NET is web service designed to send and receive messages using SOAP over HTTP.

WCF can exchange messages using any format (SOAP is default) over any transport protocol such as HTTP, TCP/IP, MSMQ, NamedPipes etc.

Is it possible to have different access modifiers on the get and set methods of a property in .NET?

No we can not have different modifiers of a common property, which means that if the access modifier of a property’s get method is protected, and it must be protected for the set method as well.

In .NET, is it possible for two catch blocks to be executed in one go?

This is NOT possible because once the correct catch block is executed then the code flow goes to the finally block.