Q. Can we overload methods in the WCF?
A. Yes we can overload the methods in the WCF for that we need to use the Name property of the OperationContract to give different method name in the proxy.
[ServiceContract]Q. What is host factory in the WCF?
Public Interface Sample
{
[OperationContract(Name = "IntergerOverload")]
Int OverloadMethod(int paramA, int paramB)
[OperationContract(Name = "DoubleOverload")]
double OverloadMethod(double paramA, double paramB)
}
A. Using Service host factory we can create service host dynamically as request comes in and we need to use ServiceFactory class for this purpose.
Q. In the WCF service can we pass.Net exception information to the client?
A. Service will not return the exception information directly to the client but WCF service can pass it as the SOAP message.
Q. How can we set concurrency mode in the WCF?
A. Concurrency mode can be specified by ServiceBehavior attribute on the implementation class
[ServiceBehavior(ConcurrencyMode=ConcurrencyMode.Single)]There are 3 possible values of ConcurrencyMode enumeration
Public class SamplServiceImpl : ISample{
//Implementation Code
}
- Single
- Reentrant
- Multiple
Q. Which protocol used for the platform independent communication in WCF?
A. SOAP(Simple Object Access Protocol) is used in WCF for the platform independent communication in the WCF.
This comment has been removed by the author.
ReplyDelete