.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
 
Sign In
Register
 
Win Surprise Gifts!!!
Congratulations!!!




Find questions, FAQ's and their answers related to .NET, C#, Vb.Net, Sql Server and many more.


Post New Question Subscribe to Interview Questions
 
Quick Links For Interview Questions Categories:
ASP.NetWindows Application  .NET Framework  C#  VB.Net  ADO.Net  
Sql Server  SharePoint  Silverlight  OOPs  JQuery  JavaScript/VBScript
BiztalkPatten/PracticesIISWCFWPFWWF
NetworkingAptitudeOthers  All    
 

WCF Interview Questions and Answers

What is Windows Server AppFabric?

Author: Alankar          Posted Date: April 02, 2015    Category: WCF     Points: 40

It is a set of extensions to the Windows OS aimed at making it easier for developers to build faster, scalable, and more-easily managed services.

It provides a distributed in-memory caching service and replication technology that helps developers improve the speed and availability of .NET Web applications and WCF services.

If you are hosting WCF services by using IIS or WAS in a production environment, you might want to consider implementing Windows Server AppFabric.

You can use use AppFabric in place of Memcached because AppFabric provides more feature than Memcached

Difference between reliable messaging and reliable sessions in WCF ?

Author: Alankar          Posted Date: April 02, 2015    Category: WCF     Points: 40

Reliable messaging is concerned with ensuring that messages are delivered exactly once.

Reliable session provides a context for sending and receiving a series of reliable messages. reliable sessions have a dependency on reliable messaging.

You have to use reliable messaging to provide an end-to-end reliable session between a client application and a service.

So finally, both are different but related concepts


In what are the different ways a WCF Metadata can be accessed ?

Author: Alankar          Posted Date: April 02, 2015    Category: WCF     Points: 40

WCF Metadata can be accessed in two ways :-

(1) WSDL document can be generated which represents the endpoints and protocols

(2) Or the ServiceHost can expose a metadata exchange endpoint to access metadata at runtime

Can you show a sample of Duplex Contract in WCF ?

Author: Alankar          Posted Date: April 02, 2015    Category: WCF     Points: 40


[ServiceContract(Namespace = "http://www.Microsoft.com",

SessionMode = SessionMode.Required,

CallbackContract = typeof(IDuplexCallBack) )]



public interface IService1

{

[OperationContract(IsOneWay = true)]

void getData();

}



public interface IDuplexCallBack

{
[OperationContract(IsOneWay = true)]

void filterData(DataSet Output);

}


In the above code, getData() is a method which will be called by the client on the Service. This getdata() is implemented in the server side.

filterData() is a method which will be called by the server on the Client. This method is implemented in the client side.

CallbackContract is the name of the contract which will be called by the server on the client to raise an event or to get some information from the client.

What is duplex contract in WCF?

Author: Alankar          Posted Date: April 02, 2015    Category: WCF     Points: 40

In Duplex contract, clients and servers can communicate with each other independently.

Duplex contracts consists of two one-way contracts so that parallel communication is achieved.

What is Sessionful Services in WCF One Way Contract ?

Author: Alankar          Posted Date: April 02, 2015    Category: WCF     Points: 40

[ServiceContract(SessionMode = SessionMode.Required)]

interface IService

{

[OperationContract(IsOneWay = true)]

void Method1();

}

If the client issues a one-way call and then closes the proxy while the method executes, the client will still be blocked until the operation completes.


Please note that the above is a bad design because clients are never meant to be blocked when using one way contract.

Is the below code correct :- [ServiceContract] interface IMyContract { [OperationContract(IsOneWay = true)] int MyMethod( ); }

Author: Alankar          Posted Date: April 02, 2015    Category: WCF     Points: 40

No, there should be no reply associated with a one-way operation. In the above an integer value is returned even though the IsOneWay property is true !

In WCF, while using one way contract, suppose a client invokes a method and the server while executing it, encounters an error. Will the error message propagate to the client or will the client ever know that there was an error on the server side ?

Author: Alankar          Posted Date: April 02, 2015    Category: WCF     Points: 40

No, one-way operations cannot return values and any exception thrown on the service side will not make its way to the client. The client will never know whether there was an error or not !

How is WCF One Way Contract is implemented ?

Author: Alankar          Posted Date: April 02, 2015    Category: WCF     Points: 40

WCF one way contract is implemented via "IsOneWay = true/false" attribute.
For example :-
[ServiceContract]

interface IMyContract

{

[OperationContract(IsOneWay = true)]

void MyMethod( );

}




What is the most primary reason to use WCF One Way Contract ?

Author: Alankar          Posted Date: April 02, 2015    Category: WCF     Points: 40

One way contract is used to ensure that the WCF client does not go in a blocking mode . If your WCF operation contracts are returning nothing and they are doing some heavy process then it is better to use one way contract.



Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend