What is WCF?
WCF is a programming platform introduced by microsoft to create distributed application services. It is a latest service oriented technology which consist combined web service, remoting, msmq and com+.
Advantage of WCF
-
Better reliability and security in compared to ASMX web services.
-
No need to change too much code to change binding.(change in configuration)
-
Integrated logging mechanism. (change in configuration)
-
It can be hosted on IIS, WAS, Self hosting, Windows services
-
Easy serialization.
What is ABC?
Without ABC there is no WCF. ABC means Address, Binding and Contract.
What are ends, contract, address, and bindings?
-
Address: Its define the unique address of services based on transport protocol.
-
like:-
-
-
-
net.tcp://localhost:8002/firstservice
-
net.pipe://localhost/piped
-
net.msmq://localhost/firstservice
-
Binding:It specify how to define these address based on transport protocols.
-
like:-
-
Basic binding
-
TCP binding
-
Peer network binding
-
Web Service (WS) binding
-
Duplex WS binding
-
MSMQ integration binding
-
Contract: In WCF, all services expose contracts. The contract is a platform-neutral and standard way of describing what the service does.
-
WCF defines four types of contracts.
-
Service contracts: Describe which operations the client can perform on the service.
[ServiceContract]
interface IFirstContract
{
[OperationContract]
string MyAdd( );
}
-
Data contracts:
Define which data types are passed to and from the service. WCF defines implicit contracts for built-in types such as int and string, but you can easily define explicit opt-in data contracts for custom types.
[DataContract]
struct Contact
{
[DataMember]
public string FirstName;
[DataMember]
public string LastName;
}
Better reliability and security in compared to ASMX web services.
No need to change too much code to change binding.(change in configuration)
Integrated logging mechanism. (change in configuration)
It can be hosted on IIS, WAS, Self hosting, Windows services
Easy serialization.
Address: Its define the unique address of services based on transport protocol.
- like:-
- net.tcp://localhost:8002/firstservice
- net.pipe://localhost/piped
- net.msmq://localhost/firstservice
Binding:It specify how to define these address based on transport protocols.
- like:-
- Basic binding
- TCP binding
- Peer network binding
- Web Service (WS) binding
- Duplex WS binding
- MSMQ integration binding
Contract: In WCF, all services expose contracts. The contract is a platform-neutral and standard way of describing what the service does.
- WCF defines four types of contracts.
- Service contracts: Describe which operations the client can perform on the service.
Data contracts: