WCF Services
| Address | Endpoints address is the location of the service, must be unique. The client and server both define end points. |
| Binding | Defines whether to use HTTP, TCP, MSMQ, Binary HTTP .. etc.. The bindings transport. |
| Contract | The public definition or interface. Different contract types including Service contract, operation contract, message contract, fault contract and data contract. |
The service must be hosted by something, for example IIS. Service endpoints have the .svc extension.
WCF Layers
| Contract Layer | Service, Operation, Data, Message, Policy and Binding. |
| Runtime Layer | Transactions, Concurrency, Dispatch, Parameter Filtering, Throttling, Error, Metadata, Intance, Message Inspection. |
| Messaging Layer | HTTP, TCP, Named Pipes, MSMQ, Transaction Flow, WS Security, WS Reliable Messaging, Encoding. |
| Hosting Layer | IIS, Windows Activation Service (WAS), Windows Service, EXE, COM+ (Enterprise Services) |
WCF Attributes
- [DataContract] - Goes above custom class definition to be passed in and out of the service.
- [DataMember] - Goes above public properties in the DataContract class.
- [ServiceContract] - Above the interface to be implemented by the service.
- [OperationContract] - Above the methods in the ServiceContract interface (can define IsOneWay, ProtectionLevel, AsyncPattern.
Calling from client script (REST & JSON)
- [AspNetCompatibilityRequirements(RequirementsMode = AspNetCompatibilityRequirements.Allowed] - Above the service .
- [WebInvoke] - Above the method (as well as [OperationContract]). This is for HTTP Post.
- [WebGet] - This is for HTTP Get (allows caching of results).