Wednesday, December 11, 2013

Interview questions on WCF


Today i would like to share something about WCF, This is my first post on Windows Communication Foundation (WCF). since last 1 year i worked on WCF, so i would like to share my experience/points with you.
First will see what exactly mean by WCF . It's Microsoft programming model which helps for building service-oriented application. where we can send/ received the data asynchronously. service endpoint is the main channel where client can request data.

It has very good features :

1. Extensibility
2. Interoperability
3. Data Contracts
4. Security
5. Transactions
6. AJAX and REST Support
You may refer more about wcf here
 
 
Below interview question helps you to know more about WCF.
 
1.How session management worked in WCF?
answer - WCF manage the session by instanciating the service class. It basically used the Instance Context class to manage the server side at server side. you can refer more about Session management in WCF.


 
2. Is overloading possible in WCF? and How?
Yes method overloading is possbile in WCF. But yes it will raise the error as contract mismatch during method overload.
By providing the unique operationcontract name you can resolved that issue. It has Name property which expose the wcf method to schemas.
Look at the below example.
 
[ServiceContract]

public interface ICalculate
{

    [OperationContract(Name="ADD")]
    string methodName(int x,int y);
    

    [OperationContract(Name = "DISPLAY")]
    string methodName(string val1, string val2);
}
 
all the method get called by their attribute name and parameter value. 
for ex
ClientApp client = new ClientApp();
           
string method1 = client.methodName(1, 1);

string method2 = client.methodName("sample1", "sample2");

3.how to track no of visit to your service.
WCF has very good feature which enable us to manage the service call. with the help of this you can easily track the count. extension point is used.


4. list types of binding and have you worked on netMsmqBinding or netNamedPipeBinding ?
 
 
If you know more unique questions, please do share it.

No comments:

Post a Comment