The Windows Communication Foundation
Interoperability & Integration Secure, Reliable, Transacted Messaging Decoupled, Dynamic Applications The Connectivity Imperative
.NET At The Core
Windows Communication Foundation The Unified Framework For Rapidly Building  Service-Oriented Applications
Windows Communication Foundation INTEROPERABILITY PRODUCTIVITY SERVICE-ORIENTED DEVELOPMENT Broad Support for WS-* specifications Compatible with existing MS distributed application technologies Unifies today’s distributed technologies Attribute-based development Visual Studio 2005 integration Enables development of loosely-coupled services Config-based communication
Unified Programming Model Interop with other platforms ASMX Attribute-  Based Programming Enterprise Services WS-* Protocol Support WSE Message- Oriented Programming System.Messaging Extensibility Location transparency .NET Remoting
WS-* Protocol Support XML Messaging Security Transactions Reliable Messaging Metadata
Investment Protection SIDE-BY-SIDE Interop UPGRADE
SERVICE ORIENTATION
From Objects to Services Polymorphism Encapsulation Subclassing Message-based Schema+Contract+Policy Broad Interop Location Transparent Tight Coupling Runtime Metadata Object-Oriented Service-Oriented Component-Oriented 1980s 2000s 1990s
Four Tenets of Service Orientation SERVICE ORIENTATION Compatibility Based On Policy Share Schema & Contract, Not Class Services Are Autonomous Boundaries Are Explicit
Conventional Web Services The old way of easily exposing components (ASMX): .NET Component ASMX Web Service HTTP Client
WCF Services The new way of easily exposing components (WCF): .NET Component HTTP Host TCP Host ICP Host MSMQ Host HTTP Client TCP Client ICP Client MSMQ Client Service Contract
The Windows Communication Foundation
Main Design Goal Unification Unify today’s distributed technology stacks Talk on-machine, cross-machine, cross-networks & Internet Productivity Codify best practices for building distributed apps Maximize productivity Integration Interoperate with apps running on other platforms Integrate with Microsoft’s existing technologies
Agenda Introduction Overview Main Concepts Hello World Contracts Bindings Behaviours Summary
Callers and Services Caller Service
Endpoints Caller Service Endpoint Endpoint Endpoint Endpoint
Address, Binding, Contract Service Caller C B A C B A A B C Address Where? Contract What? Binding How? C B A
Creating Endpoints Service Service Host Caller Proxy or ChannelFactory A B C C B A C B A C B A
Exposing & Configuring Endpoints proxy.cs Caller app/web.config GetMetadata WSDL Service ? C B A C B A C B A C B A C B A C B A
Hello World
Agenda Introduction Overview Contracts Service Data Message Bindings Behaviours Instancing Summary
WCF Contracts Overview Service Contracts Describe the operations a service can perform Map CLR types to WSDL Data Contracts Describes a data structure Maps CLR types to XSD Message Contracts Defines the structure of the message on the wire Maps CLR types to SOAP messages
Service Contract [ServiceContract] public interface ICalculator { [OperationContract] int DoMath(int a, int b, string op); }
Service Contract An Opt-In Model [ServiceContract] public interface ICalculator { [OperationContract] int DoMath(int a, int b, string op); // Not exposed as part of the external contract :-) void MethodRequiredForImplementation(bool b); }
Operations Types Message  DoXmlMath( Message  m); Untyped (“Universal”) MathResponse  DoMsgMath( MathRequest  msg); int  DoParamsMath( int a, int b, string op ); Typed Message Parameterized Operations (shorthand for TM)
Service Contract: Names [ServiceContract( Namespace ="http://TechEd.WCF.Intro")] public interface IGreetings { [OperationContract(  Name =“SayHello", Action ="http://TechEd.WCF.Intro/HelloRequest", ReplyAction ="http://TechEd.WCF.Intro/HelloResponse")] string Greet(string name); [OperationContractAttribute( Action = "*" )] void UnrecognizedMessageHandler( Message msg ); } class GreetingService : IGreetings { public string Greet(string name) { return “Hello, " + name; } public void UnrecognizedMessageHandler(Message msg) { Console.WriteLine("Unrecognized message: " + msg.ToString()); } }
Modeling Request/Reply Operations On the wire everything is asynchronous Therefore, Request and Reply correlation can be modeled in 2 ways It can be modeled either as a synchronous (blocking) method call or using the .NET Async-Pattern The implementation on the client and the service can be  different ! [OperationContract] MathResponse DoMsgMath(MathRequest msg); [OperationContrac t(AsyncPattern=true) ] IAsyncResult BeginDoMsgMath(MathRequest msg,  AsyncCallback cb, object state ) ; MathResponse EndDoMsgMath(IAsyncResult call);
Service Contract: OneWay [ServiceContract] public interface IOneWayCalculator { [OperationContract( IsOneWay=true )] void DoMath(MathRequest request); }
Service Contract: Duplex [ServiceContract(SessionMode=SessionMode.Required,  CallbackContract=typeof(ICalculator Results ) ] public interface ICalculatorProblems { [OperationContract(IsOneWay=true)] void DoMath(MathRequest request); } public interface ICalculatorResults { [OperationContract(IsOneWay=true)] void DisplayResults(MathResponse response); }
Service Contract: Faults t ry { return n1 / n2; } catch (DivideByZeroException e)   { MyMathFault f = new MyMathFault (n1, n2); FaultReason r = new FaultReason(&quot;Divide By Zero&quot;); throw new Fault Exception < MyMathFault >( f, r ); } [ServiceContract(Session=true)] public interface ICalculator { [OperationContract] [FaultContract(typeof( MyMathFault ))] int DoMath(int a, int b, string op); }
Service Contract: Versioning [ServiceContract] public interface  ICalculator2 : ICalculator { [OperationContract(IsOneWay=true)] void SolveAndStoreProblem (ComplexProblem p); }
Service Contract: Streams [ServiceContract ] public interface IStreamCalculator { [OperationContract] Stream  Fibonacci(int iterations); }
Data Contract [DataContract] public enum Position { [ EnumMember ] Employee, [ EnumMember ] Manager, [ EnumMember( Value =  “ Vendor&quot; ) ] Contractor, NotASerializableEnumeration }
Data Contract: Names [DataContract( Name=“Complex”,   Namespace=“http://BigMath.Samples” )] public class ComplexNumber { [DataMember( Name=“RealPart” )]    public double Real = 0.0D;   [DataMember( Name=“ImaginaryPart” )]   public double Imaginary = 0.0D;   public ComplexNumber(double r, double i)   {   this.Real = r;   this.Imaginary = i;   } }
Data Contract: Enumerations [DataContract] public enum Position { [EnumMember] Employee, [EnumMember] Manager, [EnumMember(Value = “Vendor&quot;)] Contractor, NotASerializableEnumeration }
Message Contract [MessageContract] public class ComplexProblem { [MessageHeader(Name=&quot;Op&quot;, MustUnderstand=true)]    public string operation; [MessageBodyMember]   public ComplexNumber n1; [MessageBodyMember]   public ComplexNumber n2; [MessageBodyMember]   public ComplexNumber solution;   // Constructors… }
Mapping Contracts (1/2) [ MessageContract ] public class MyRequest { [MessageHeader]  public int Amount; [MessageBody]   public ItemInfo Info; } [ DataContract ] public class ItemInfo { [DataMember]  public int ID; [DataMember]  public double Cost; [DataMember]  public string Name; } wsdl:message wsdl:part xsd:element
Mapping Contracts (2/2) [ ServiceContract ] public interface MyContract { [OperationContract]   MyReply MyOp(MyRequest request); [OperationContract]   void MyOp2(MyRequest2 request); } wsdl:portType wsdl:operation
Agenda Introduction Overview Contracts Bindings Behaviours Summary
Bindings & Binding Elements Transport IPC MSMQ Custom TCP HTTP Protocol Encoders .NET TX Custom Security Reliability Binding HTTP TX Security Reliability Text Text Binary Custom TCP Binary
Binding Element Features Transport selection TCP, HTTP, Named Pipes, P2P, MSMQ, Custom Transport level security, Streaming Encoding Text, Binary, MTOM, Custom End-to-end Security Confidentiality, integrity, authN, authZ, Federation Credentials: X509, User/Pwd, Kerberos, SAML, InfoCard , Custom End-to-end Reliable messaging Transport independent QoS (in order, exactly once) Volatile and durable queues Transactions Shared transactions for “synchronous” operations Transactional queues for “asynchronous” operations [Your own feature goes here]
System-Provided Bindings N = None | T = Transport | M = Message | B = Both | RS = Reliable Sessions Binding  Interop Security Session TX Duplex  BasicHttpBinding  BP 1.1 N, T N N n/a WSHttpBinding  WS M , T, X N , T, RS N , Yes n/a WSDualHttpBinding  WS M RS N , Yes Yes WSFederationBinding  Federation M N , RS N , Yes No NetTcpBinding  .NET T , M T  ,RS N , Yes Yes NetNamedPipeBinding  .NET T T , N N , Yes Yes NetPeerTcpBinding  Peer T N N Yes NetMsmqBinding  .NET T , M, X N N , Yes No MsmqIntegrationBinding  MSMQ T N N , Yes n/a
Binding in Config <?xml version=&quot;1.0&quot; encoding=&quot;utf-8&quot; ?> <configuration> <system.serviceModel> <services> <service serviceType=&quot;CalculatorService&quot;> <endpoint address=&quot;Calculator&quot; bindingSectionName=&quot;basicProfileBinding&quot; contractType=&quot;ICalculator&quot; /> </service> </services> </system.serviceModel> </configuration>
Configuring Bindings <endpoint address=&quot;Calculator&quot;   bindingSectionName=&quot; basic Http Binding &quot;   bindingConfiguration=&quot; UsernameBinding &quot;   contractType=&quot;ICalculator&quot; /> <bindings>   <basicHttpBinding> <binding name=&quot; UsernameBinding &quot;  messageEncoding=&quot;Mtom&quot;> <security mode=&quot;Message&quot;> <message clientCredentialType=&quot;UserName&quot;/> </security> </binding> </basicHttpBinding> < /bindings>
Custom Bindings <bindings> <customBinding> <customBinding> <binding name=&quot;ReliableTCP&quot;> <reliableSession   inactivityTimeout=&quot;0:0:5“ ordered=&quot;true&quot;/> <binaryMessageEncoding/> <tcpTransport transferMode=&quot;Buffered&quot;/> </binding> </customBinding> </customBinding> </bindings>
Choosing Bindings Any Protocol Any Binding Any Binding WCF WCF MSMQ WCF COM+/ES WCF MSMQ Protocol WS-* Protocols MSMQ Binding Moniker ASMX/WSE3 WCF WS-* Protocols Http/WS Binding Other Platform WCF WS-* Protocols Http/WS Binding
Interaction of Bindings and Code Bindings provide features that affect code Session Duplex Ordered Delivery Transaction Flow Queued Delivery Attribute capture the code’s requirements Infrastructure ensures that all the bindings satisfy these requirements
Agenda Introduction Overview Contracts Bindings Behaviours Summary
Behaviors Client-Side  Behaviors Service-Side Behaviors Service Caller Be Be C B A C B A A B C C B A
Behaviors: Overview Behaviors are all local Developers care about some behaviors Concurrency, instancing model, … Everything that affects the correctness of the service Deployers care about other behaviors Throttling, Metadata exposure, message routing info, … Everything that has to do with the service’s runtime aspects Anything you can do in config, you can do in code Code is King – you can always override the config settings
Example: Security Service Client Be Be Bindings Move Claims in Messages Behaviors Implement Security Gates Behaviors Provide Credentials C B A C B A A B C C B A
Example: Transactions Service Caller Be Bindings Flow Transactions Behaviors AutoEnlist and AutoComplete C B A C B A A B C C B A
Anti-Example: Reliable Sessions Service Caller Bindings provide Session and Guarantees C B A C B A A B C C B A
Behavior Features Operation timeouts (close, open, idle) Concurrency, Instancing, Thread-Binding Throttling Faults, Exceptions Impersonation, Authorization, Auditing AutoEnlist, AutoComplete, Timeout, Isolation Serialization, MustUnderstand Metadata More…
Features Summary Address Binding Behavior Contract HTTP Transport TCP Transport NamedPipe Transport MSMQ Transport Custom Transport WS-Security Protocol WS-RM Protocol WS-AT Protocol Duplex Channel Custom Protocol http://... net.tcp://... net.pipe://... net.msmq://... xxx://... Throttling Behavior Metadata Behavior Error  Behavior Custom Behavior Instancing Behavior Concurrency Behavior Transaction Behavior Security Behavior Request/ Response One-Way Duplex net.p2p://... Peer Transport Externally visible, per-endpoint Opaque, per-service, endpoint, or op
WCF Application “Architecture” Channels Transport Channels   (IPC, HTTP, TCP…) Reliability Message  Encoder Security Hosting Environments WAS IIS .exe Windows Service DllHost Messaging Services Queuing Routing Eventing Discovery Service Model Application Instance  Manager Context  Manager Type Integration Service Methods Declarative Behaviors Transacted Methods
Presentation Takeaways WCF is the future of distributed computing It combines the best of all existing Microsoft distributed computing stacks It uses WS-* standards for interoperability and .NET value-add for performance and integration with existing solutions WCF is available for Windows Vista, Windows XP SP2, Windows Server 2003 Download WCF Today! http://www.NetFx3.com/   Presentation code at ShyCohen.com
 

introduction to Windows Comunication Foundation

  • 1.
  • 2.
  • 3.
    Interoperability & IntegrationSecure, Reliable, Transacted Messaging Decoupled, Dynamic Applications The Connectivity Imperative
  • 4.
  • 5.
    Windows Communication FoundationThe Unified Framework For Rapidly Building Service-Oriented Applications
  • 6.
    Windows Communication FoundationINTEROPERABILITY PRODUCTIVITY SERVICE-ORIENTED DEVELOPMENT Broad Support for WS-* specifications Compatible with existing MS distributed application technologies Unifies today’s distributed technologies Attribute-based development Visual Studio 2005 integration Enables development of loosely-coupled services Config-based communication
  • 7.
    Unified Programming ModelInterop with other platforms ASMX Attribute- Based Programming Enterprise Services WS-* Protocol Support WSE Message- Oriented Programming System.Messaging Extensibility Location transparency .NET Remoting
  • 8.
    WS-* Protocol SupportXML Messaging Security Transactions Reliable Messaging Metadata
  • 9.
  • 10.
  • 11.
    From Objects toServices Polymorphism Encapsulation Subclassing Message-based Schema+Contract+Policy Broad Interop Location Transparent Tight Coupling Runtime Metadata Object-Oriented Service-Oriented Component-Oriented 1980s 2000s 1990s
  • 12.
    Four Tenets ofService Orientation SERVICE ORIENTATION Compatibility Based On Policy Share Schema & Contract, Not Class Services Are Autonomous Boundaries Are Explicit
  • 13.
    Conventional Web ServicesThe old way of easily exposing components (ASMX): .NET Component ASMX Web Service HTTP Client
  • 14.
    WCF Services Thenew way of easily exposing components (WCF): .NET Component HTTP Host TCP Host ICP Host MSMQ Host HTTP Client TCP Client ICP Client MSMQ Client Service Contract
  • 15.
  • 16.
    Main Design GoalUnification Unify today’s distributed technology stacks Talk on-machine, cross-machine, cross-networks & Internet Productivity Codify best practices for building distributed apps Maximize productivity Integration Interoperate with apps running on other platforms Integrate with Microsoft’s existing technologies
  • 17.
    Agenda Introduction OverviewMain Concepts Hello World Contracts Bindings Behaviours Summary
  • 18.
    Callers and ServicesCaller Service
  • 19.
    Endpoints Caller ServiceEndpoint Endpoint Endpoint Endpoint
  • 20.
    Address, Binding, ContractService Caller C B A C B A A B C Address Where? Contract What? Binding How? C B A
  • 21.
    Creating Endpoints ServiceService Host Caller Proxy or ChannelFactory A B C C B A C B A C B A
  • 22.
    Exposing & ConfiguringEndpoints proxy.cs Caller app/web.config GetMetadata WSDL Service ? C B A C B A C B A C B A C B A C B A
  • 23.
  • 24.
    Agenda Introduction OverviewContracts Service Data Message Bindings Behaviours Instancing Summary
  • 25.
    WCF Contracts OverviewService Contracts Describe the operations a service can perform Map CLR types to WSDL Data Contracts Describes a data structure Maps CLR types to XSD Message Contracts Defines the structure of the message on the wire Maps CLR types to SOAP messages
  • 26.
    Service Contract [ServiceContract]public interface ICalculator { [OperationContract] int DoMath(int a, int b, string op); }
  • 27.
    Service Contract AnOpt-In Model [ServiceContract] public interface ICalculator { [OperationContract] int DoMath(int a, int b, string op); // Not exposed as part of the external contract :-) void MethodRequiredForImplementation(bool b); }
  • 28.
    Operations Types Message DoXmlMath( Message m); Untyped (“Universal”) MathResponse DoMsgMath( MathRequest msg); int DoParamsMath( int a, int b, string op ); Typed Message Parameterized Operations (shorthand for TM)
  • 29.
    Service Contract: Names[ServiceContract( Namespace =&quot;http://TechEd.WCF.Intro&quot;)] public interface IGreetings { [OperationContract( Name =“SayHello&quot;, Action =&quot;http://TechEd.WCF.Intro/HelloRequest&quot;, ReplyAction =&quot;http://TechEd.WCF.Intro/HelloResponse&quot;)] string Greet(string name); [OperationContractAttribute( Action = &quot;*&quot; )] void UnrecognizedMessageHandler( Message msg ); } class GreetingService : IGreetings { public string Greet(string name) { return “Hello, &quot; + name; } public void UnrecognizedMessageHandler(Message msg) { Console.WriteLine(&quot;Unrecognized message: &quot; + msg.ToString()); } }
  • 30.
    Modeling Request/Reply OperationsOn the wire everything is asynchronous Therefore, Request and Reply correlation can be modeled in 2 ways It can be modeled either as a synchronous (blocking) method call or using the .NET Async-Pattern The implementation on the client and the service can be different ! [OperationContract] MathResponse DoMsgMath(MathRequest msg); [OperationContrac t(AsyncPattern=true) ] IAsyncResult BeginDoMsgMath(MathRequest msg, AsyncCallback cb, object state ) ; MathResponse EndDoMsgMath(IAsyncResult call);
  • 31.
    Service Contract: OneWay[ServiceContract] public interface IOneWayCalculator { [OperationContract( IsOneWay=true )] void DoMath(MathRequest request); }
  • 32.
    Service Contract: Duplex[ServiceContract(SessionMode=SessionMode.Required, CallbackContract=typeof(ICalculator Results ) ] public interface ICalculatorProblems { [OperationContract(IsOneWay=true)] void DoMath(MathRequest request); } public interface ICalculatorResults { [OperationContract(IsOneWay=true)] void DisplayResults(MathResponse response); }
  • 33.
    Service Contract: Faultst ry { return n1 / n2; } catch (DivideByZeroException e) { MyMathFault f = new MyMathFault (n1, n2); FaultReason r = new FaultReason(&quot;Divide By Zero&quot;); throw new Fault Exception < MyMathFault >( f, r ); } [ServiceContract(Session=true)] public interface ICalculator { [OperationContract] [FaultContract(typeof( MyMathFault ))] int DoMath(int a, int b, string op); }
  • 34.
    Service Contract: Versioning[ServiceContract] public interface ICalculator2 : ICalculator { [OperationContract(IsOneWay=true)] void SolveAndStoreProblem (ComplexProblem p); }
  • 35.
    Service Contract: Streams[ServiceContract ] public interface IStreamCalculator { [OperationContract] Stream Fibonacci(int iterations); }
  • 36.
    Data Contract [DataContract]public enum Position { [ EnumMember ] Employee, [ EnumMember ] Manager, [ EnumMember( Value = “ Vendor&quot; ) ] Contractor, NotASerializableEnumeration }
  • 37.
    Data Contract: Names[DataContract( Name=“Complex”, Namespace=“http://BigMath.Samples” )] public class ComplexNumber { [DataMember( Name=“RealPart” )] public double Real = 0.0D; [DataMember( Name=“ImaginaryPart” )] public double Imaginary = 0.0D; public ComplexNumber(double r, double i) { this.Real = r; this.Imaginary = i; } }
  • 38.
    Data Contract: Enumerations[DataContract] public enum Position { [EnumMember] Employee, [EnumMember] Manager, [EnumMember(Value = “Vendor&quot;)] Contractor, NotASerializableEnumeration }
  • 39.
    Message Contract [MessageContract]public class ComplexProblem { [MessageHeader(Name=&quot;Op&quot;, MustUnderstand=true)] public string operation; [MessageBodyMember] public ComplexNumber n1; [MessageBodyMember] public ComplexNumber n2; [MessageBodyMember] public ComplexNumber solution; // Constructors… }
  • 40.
    Mapping Contracts (1/2)[ MessageContract ] public class MyRequest { [MessageHeader] public int Amount; [MessageBody] public ItemInfo Info; } [ DataContract ] public class ItemInfo { [DataMember] public int ID; [DataMember] public double Cost; [DataMember] public string Name; } wsdl:message wsdl:part xsd:element
  • 41.
    Mapping Contracts (2/2)[ ServiceContract ] public interface MyContract { [OperationContract] MyReply MyOp(MyRequest request); [OperationContract] void MyOp2(MyRequest2 request); } wsdl:portType wsdl:operation
  • 42.
    Agenda Introduction OverviewContracts Bindings Behaviours Summary
  • 43.
    Bindings & BindingElements Transport IPC MSMQ Custom TCP HTTP Protocol Encoders .NET TX Custom Security Reliability Binding HTTP TX Security Reliability Text Text Binary Custom TCP Binary
  • 44.
    Binding Element FeaturesTransport selection TCP, HTTP, Named Pipes, P2P, MSMQ, Custom Transport level security, Streaming Encoding Text, Binary, MTOM, Custom End-to-end Security Confidentiality, integrity, authN, authZ, Federation Credentials: X509, User/Pwd, Kerberos, SAML, InfoCard , Custom End-to-end Reliable messaging Transport independent QoS (in order, exactly once) Volatile and durable queues Transactions Shared transactions for “synchronous” operations Transactional queues for “asynchronous” operations [Your own feature goes here]
  • 45.
    System-Provided Bindings N= None | T = Transport | M = Message | B = Both | RS = Reliable Sessions Binding Interop Security Session TX Duplex BasicHttpBinding BP 1.1 N, T N N n/a WSHttpBinding WS M , T, X N , T, RS N , Yes n/a WSDualHttpBinding WS M RS N , Yes Yes WSFederationBinding Federation M N , RS N , Yes No NetTcpBinding .NET T , M T ,RS N , Yes Yes NetNamedPipeBinding .NET T T , N N , Yes Yes NetPeerTcpBinding Peer T N N Yes NetMsmqBinding .NET T , M, X N N , Yes No MsmqIntegrationBinding MSMQ T N N , Yes n/a
  • 46.
    Binding in Config<?xml version=&quot;1.0&quot; encoding=&quot;utf-8&quot; ?> <configuration> <system.serviceModel> <services> <service serviceType=&quot;CalculatorService&quot;> <endpoint address=&quot;Calculator&quot; bindingSectionName=&quot;basicProfileBinding&quot; contractType=&quot;ICalculator&quot; /> </service> </services> </system.serviceModel> </configuration>
  • 47.
    Configuring Bindings <endpointaddress=&quot;Calculator&quot; bindingSectionName=&quot; basic Http Binding &quot; bindingConfiguration=&quot; UsernameBinding &quot; contractType=&quot;ICalculator&quot; /> <bindings> <basicHttpBinding> <binding name=&quot; UsernameBinding &quot; messageEncoding=&quot;Mtom&quot;> <security mode=&quot;Message&quot;> <message clientCredentialType=&quot;UserName&quot;/> </security> </binding> </basicHttpBinding> < /bindings>
  • 48.
    Custom Bindings <bindings><customBinding> <customBinding> <binding name=&quot;ReliableTCP&quot;> <reliableSession inactivityTimeout=&quot;0:0:5“ ordered=&quot;true&quot;/> <binaryMessageEncoding/> <tcpTransport transferMode=&quot;Buffered&quot;/> </binding> </customBinding> </customBinding> </bindings>
  • 49.
    Choosing Bindings AnyProtocol Any Binding Any Binding WCF WCF MSMQ WCF COM+/ES WCF MSMQ Protocol WS-* Protocols MSMQ Binding Moniker ASMX/WSE3 WCF WS-* Protocols Http/WS Binding Other Platform WCF WS-* Protocols Http/WS Binding
  • 50.
    Interaction of Bindingsand Code Bindings provide features that affect code Session Duplex Ordered Delivery Transaction Flow Queued Delivery Attribute capture the code’s requirements Infrastructure ensures that all the bindings satisfy these requirements
  • 51.
    Agenda Introduction OverviewContracts Bindings Behaviours Summary
  • 52.
    Behaviors Client-Side Behaviors Service-Side Behaviors Service Caller Be Be C B A C B A A B C C B A
  • 53.
    Behaviors: Overview Behaviorsare all local Developers care about some behaviors Concurrency, instancing model, … Everything that affects the correctness of the service Deployers care about other behaviors Throttling, Metadata exposure, message routing info, … Everything that has to do with the service’s runtime aspects Anything you can do in config, you can do in code Code is King – you can always override the config settings
  • 54.
    Example: Security ServiceClient Be Be Bindings Move Claims in Messages Behaviors Implement Security Gates Behaviors Provide Credentials C B A C B A A B C C B A
  • 55.
    Example: Transactions ServiceCaller Be Bindings Flow Transactions Behaviors AutoEnlist and AutoComplete C B A C B A A B C C B A
  • 56.
    Anti-Example: Reliable SessionsService Caller Bindings provide Session and Guarantees C B A C B A A B C C B A
  • 57.
    Behavior Features Operationtimeouts (close, open, idle) Concurrency, Instancing, Thread-Binding Throttling Faults, Exceptions Impersonation, Authorization, Auditing AutoEnlist, AutoComplete, Timeout, Isolation Serialization, MustUnderstand Metadata More…
  • 58.
    Features Summary AddressBinding Behavior Contract HTTP Transport TCP Transport NamedPipe Transport MSMQ Transport Custom Transport WS-Security Protocol WS-RM Protocol WS-AT Protocol Duplex Channel Custom Protocol http://... net.tcp://... net.pipe://... net.msmq://... xxx://... Throttling Behavior Metadata Behavior Error Behavior Custom Behavior Instancing Behavior Concurrency Behavior Transaction Behavior Security Behavior Request/ Response One-Way Duplex net.p2p://... Peer Transport Externally visible, per-endpoint Opaque, per-service, endpoint, or op
  • 59.
    WCF Application “Architecture”Channels Transport Channels (IPC, HTTP, TCP…) Reliability Message Encoder Security Hosting Environments WAS IIS .exe Windows Service DllHost Messaging Services Queuing Routing Eventing Discovery Service Model Application Instance Manager Context Manager Type Integration Service Methods Declarative Behaviors Transacted Methods
  • 60.
    Presentation Takeaways WCFis the future of distributed computing It combines the best of all existing Microsoft distributed computing stacks It uses WS-* standards for interoperability and .NET value-add for performance and integration with existing solutions WCF is available for Windows Vista, Windows XP SP2, Windows Server 2003 Download WCF Today! http://www.NetFx3.com/ Presentation code at ShyCohen.com
  • 61.