My Development Notes

By Haemoglobin
3/10/2010 (revision 1)

WCF Services

AddressEndpoints address is the location of the service, must be unique. The client and server both define end points.
BindingDefines whether to use HTTP, TCP, MSMQ, Binary HTTP .. etc.. The bindings transport.
ContractThe 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 LayerService, Operation, Data, Message, Policy and Binding.
Runtime LayerTransactions, Concurrency, Dispatch, Parameter Filtering, Throttling, Error, Metadata, Intance, Message Inspection.
Messaging LayerHTTP, TCP, Named Pipes, MSMQ, Transaction Flow, WS Security, WS Reliable Messaging, Encoding.
Hosting LayerIIS, 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).

Comments

Powered by BlogEngine.NET 1.6.1.0 | Design by styleshout | Enhanced by GravityCube.net | 1.4.5 Changes by zembian.com | Adapted by HamishGraham.NET
(c) 2010 Hamish Graham. Banner Image (c) Chris Gin