By default, WSDL doesn’t support operation overloading. Overloading behavior can be achieved by using “Name” property of OperationContract attribute.
[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.
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
- Console Application
- Windows Application
- Windows Service
- IIS 6.0 ( ASP.NET application supports only HTTP )
- Windows Process Activation Service (WAS) i.e. IIS 7.0 supports HTTP, TCP/IP, NamedPipes, MSMQ
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.
A 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.
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.
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.
This is NOT possible because once the correct catch block is executed then the code flow goes to the finally block.