1 / 50

Demystifying Windows Communication Foundation

Demystifying Windows Communication Foundation. Keith Elder Microsoft MVP INETA Speaker Blog: http://keithelder.net/blog/ Twitter: http://twitter.com/keithelder Podcast: http://deepfriedbytes.com. Originally from Ripley, Ms. Raised on a small farm

kaspar
Download Presentation

Demystifying Windows Communication Foundation

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Demystifying Windows Communication Foundation Keith ElderMicrosoft MVP INETA Speaker Blog: http://keithelder.net/blog/ Twitter: http://twitter.com/keithelder Podcast: http://deepfriedbytes.com

  2. Originally from Ripley, Ms Raised on a small farm Yes I have milked a cow, slopped the chickens and fed the hogs Home of the 2nd largest flea market in the US

  3. Modelled During the 80's

  4. Quicken Loans $500! Cash!

  5. About Quicken Loans • Originally founded in 1985 as Rock Financial by Dan Gilbert • Grew to one of the largest independent mortgage banks in the country • 1998 IPO • 1999 Launched Rockloans.Com • 1999 Intuit, Inc (makers of TurboTax and Quicken) purchased Rock Financial. • July 2002 Dan Gilbert purchased Quicken Loans back from Intuit. Retained Quicken Loans branding and marketing initiatives. • 5000 employees • Largest online retail home loan lender

  6. Deep Fried Bytes is an audio talk show with a Southern flavor hosted by technologists and developers Keith Elder and Chris Woodruff. The show discusses a wide range of topics including application development, operating systems and technology in general. Anything is fair game if it plugs into the wall or takes a battery. http://deepfriedbytes.com

  7. Agenda • How We Got Here • ASMX vs WCF Throwdown • WCF Contracts • Service • Data • Message • Bindings • Security • Reliability • Declarative • Summary

  8. From Objects to Services Object-Oriented Polymorphism Encapsulation Subclassing 1980s Component-Based Interface-based Dynamic Loading Runtime Metadata 1990s Service-Oriented Message-based Schema+Contract Binding via Policy 2000s

  9. The Challenge Radically Simplifying Distributed Application Development Development of connected systemsremains costly and frustrating • Different programming models for different tasks • Need for security and reliable messaging • Interoperability with applications on other platforms • Productive service-oriented programming model needed

  10. Windows Communication Foundation Unified framework for rapidly building service-oriented applications

  11. What Does WCF Replace?

  12. DEMO

  13. Our Current asmx services investment vswcf

  14. ASMX Challenge User’s Desktop Open Form Smart Client Event UserControl Java Client Event UserControl Event Service

  15. Current ASMX Web Services

  16. What’s So Different About WCF

  17. Understanding WCF principles

  18. Message Services and Clients Client Service Message

  19. Endpoint Endpoint Endpoint Endpoints Client Service Message

  20. Endpoint C C C B B B A A A Address, Binding, Contract Client Service Endpoints Message Address Binding Contract (Where) (How) (What)

  21. Transport Encoder Protocol(s) Transport Encoder Protocol(s) WCF Architecture: Messaging Runtime Service Contract andBehaviors Client Dispatcher Binding Address

  22. The what Contracts

  23. Three Types of Contracts

  24. Ways to Talk One Way • One Way: • Datagram-style delivery • Request-Reply • Immediate Reply on same logical thread • Duplex • Reply “later” and on backchannel (callback-style) Client Service Request-Reply Duplex (Dual)

  25. What does your service do? Service Contracts

  26. Service Contract using System.ServiceModel; [ServiceContract] public interface ICalculate { [OperationContract] double Add( double a, double b); [OperationContract] double Subtract( double a, double b); }

  27. Service Contract: OneWay [ServiceContract] public interface IOneWayCalculator { [OperationContract(IsOneWay=true)] void StoreProblem (ComplexProblem p); }

  28. Service Contract: Duplex Asymmetric [ServiceContract(Session=true, CallbackContract=typeof(ICalculatorResults)] public interface ICalculatorProblems { [OperationContract(IsOneWay=true)] void SolveProblem (ComplexProblem p); } public interface ICalculatorResults { [OperationContract(IsOneWay=true)] void Results(ComplexProblem p); }

  29. DEMO – SERVICE CONTRACT

  30. What object data needs to flow back and forth? Data contracts

  31. Data Contract [DataContract] public class ComplexNumber { [DataMember] public double Real = 0.0D;[DataMember] public double Imaginary = 0.0D; public ComplexNumber(double r, double i) { this.Real = r; this.Imaginary = i; } }

  32. Defines the mapping between the type and a SOAP envelope Message contracts

  33. Message Contract [MessageContract] public class ComplexProblem { [MessageHeader] public string operation; [MessageBody]public ComplexNumber n1; [MessageBody]public ComplexNumber n2; [MessageBody]public ComplexNumber solution; // Constructors… }

  34. bindings

  35. Bindings & Binding Elements Binding HTTP Text Security Reliability TX Transport Protocol Encoders TCP HTTP Security Reliability Text Binary MSMQ IPC TX .NET Custom Custom Custom

  36. Standard Bindings N = None | T = Transport | M = Message | B = Both | RS = Reliable Sessions

  37. A A A B B B C C C C B A Bindings & Behaviors: Security Client Service Be Be Bindings Insert Claims in Messages Behaviors Implement Security Gates

  38. Claims based end-to-end security Secure end-to-end message exchanges Secure access to resources Record resource access requests X509, Username/Password, Kerberos, SAML, custom credentials Message security Confidentiality and integrity Transport or message level Access to resources Authentication and authorization Feature OverviewSecurity

  39. DEMO - BINDINGS

  40. A A A B B B C C C C B A Bindings & Behaviors: Transactions Client Service Be Be Bindings Flow Transactions Behaviors AutoEnlist and AutoComplete

  41. A A A B B B C C C C B A Bindings & Behaviors: Reliable Sessions Client Service Bindings provide Session and Guarantees

  42. End-to-end Reliable messaging In-order guarantees Exactly once guarantees Transport-Independent Sessions Integration with ASP.NET Sessions in IIS-Hosted compatibility mode Transactions Guaranteed atomic success or failure across services Feature OverviewReliability and Transactions

  43. Code vs. Config

  44. Defining Endpoints <?xml version="1.0" encoding="utf-8" ?> <configuration xmlns="http://schemas.microsoft.com/.NetConfiguration/v2.0"> <system.serviceModel> <services> <service serviceType="CalculatorService"> <endpoint address="Calculator" bindingSectionName="basicProfileBinding" contractType="ICalculator" /> </service> </services> </system.serviceModel> </configuration>

  45. Configuring Bindings <endpoint address="Calculator" bindingSectionName="basicProfileBinding" bindingConfiguration="Binding1" contractType="ICalculator" /> <bindings> <basicProfileBinding> <binding configurationName="Binding1" hostnameComparisonMode="StrongWildcard" transferTimeout="00:10:00" maxMessageSize="65536" messageEncoding="Text" textEncoding="utf-8" </binding></basicProfileBinding></bindings>

  46. Custom Bindings <bindings> <customBinding> <binding configurationName="Binding1"> <reliableSession bufferedMessagesQuota="32" inactivityTimeout="00:10:00" maxRetryCount="8"ordered="true" /> <httpsTransport manualAddressing="false" maxMessageSize="65536" hostnameComparisonMode="StrongWildcard"/> <textMessageEncoding maxReadPoolSize="64"maxWritePoolSize="16"messageVersion="Default"encoding="utf-8" /> </binding> </customBinding> </bindings>

  47. DEMO – MULTIPLE BINDINGS

  48. Type Integ. Behavior … MetadataBehavior ErrorBehavior TransactionBehavior Instance Behavior Throttling Behavior ConcurrencyBehavior NT Service WinForm COM+ ASP.NET WAS WPF WCF Summary Application Service Model Messaging Text/XML Encoder … Secure Channel Reliable Channel Binary Encoder TCP Channel … HTTP Channel Queue Channel Hosting Environments

  49. WCF Summary • 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, Windows Server 2008

More Related