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.
WCF is a framework that builds applications that can inter-communicate based on service oriented architecture consuming secure and reliable web services. This also helps in Distributed computing. The WCF also brings together the various communication models into a single model.
You can select WCF data services when you
- Want to implement the Data layer.
- Want to connect with database server by using HTTP protocol.