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


Top 5 Contributors of the Month
Sandeep Singh
Mayuri
stevemarkayden
kumarfurima
Preethi


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/Practices.IISWCFWPFWWF
NetworkingAptitudeOthers  All    
 

Interview Questions And Answers

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.

Explain in brief, WCF One Way Contract ?

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

WCF One Way Contract are methods/operations which are invoked on the service by the client or the server in which either of them do not expect a responce back. For example :-

If a client invokes a method on the service then it will not expect a responce back from the service.

How can I encrypt sensitive data in the WCF configuration file?

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

To encrypt sensitive data in WCF configuration file, use aspnet_regiis.exe tool.

Example: If you want to encrypt Connection String section of WCF config file, use -pe that means provider encryption .
aspnet_regiis -pe "connectionStrings" -app "/MachineDPAPI"

-prov "DataProtectionConfigurationProvider"


-pe means provider encryption of configuration section.
-app means your application's virtual path.
-prov means provider name

How can you define an Endpoint programmatically in WCF ?

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

ServiceHost s = new ServiceHost(typeof(EmployeeReservations));

s.AddEndpoint(typeof(EmployeeReservations), new BasicHttpBinding(),

"http://www.google.com/employee/emp.svc");


EmployeeReservations is the name of the contract.
http://www.google.com/employee/emp.svc is the address of the web service.


In WCF, is SOAP envelope created while using WebHttpBinding ?

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

No, SOAP envelope is not created in WebHttpBinding . The information is trasmitted through HTTP or HTTPS.


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