1 / 33

WCF (Indigo): Under the Hood of the Channel Layer

WCF (Indigo): Under the Hood of the Channel Layer. Steve Swartz COM416 Architect Microsoft Corporation. C. C. C. B. B. B. A. A. A. From the Outside. Client. Service. Bv. Bv. Message. Bv. Bv. Address. Binding. Contract. (Where). (How). (What). C. C. B. B. A. A.

lam
Download Presentation

WCF (Indigo): Under the Hood of the Channel Layer

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. WCF (Indigo): Under the Hood of the Channel Layer Steve Swartz COM416 Architect Microsoft Corporation

  2. C C C B B B A A A From the Outside Client Service Bv Bv Message Bv Bv Address Binding Contract (Where) (How) (What)

  3. C C B B A A From the Inside Service Bv Bv

  4. Positioning This Talk • This Talk • How Does the Channel Layer Work? • Why Do You Care? • Other Talks • How Does the ServiceModel Work? • COM417: Thursday, 10:00am • How Do You Build XML Messaging Apps? • COM326: Thursday, 5:15pm • How Do You Build Channels? • COM424: Thursday, 3:45pm • How Do You Hook Channels Into WebHost? • COM413: Friday, 1:00pm

  5. Big Ideas • Bindings: How You Use The Channel Layer • Bindings Are Easy & Extensible • Channels: How Messages Are Exchanged • Channels have Shape, Capabilities, Stacks • Factories: How Channels Are Created

  6. Factory Factory Factory Listener Listener Listener Channel Channel Channel Channel Channel Channel The Talk-In-A-Slide Binding Binding Factory Listener CreateChannel<T>() AcceptChannel() Channel Channel Send() Receive() Message

  7. Factory Factory Factory Listener Listener Listener Channel Channel Channel Channel Channel Channel Agenda: Message Binding Binding Factory Listener CreateChannel<T>() AcceptChannel() Channel Channel Send() Receive() Message

  8. Message: The Basics • CLR Representation of SOAP Infoset • Supports SOAP 1.1 / SOAP 1.2 • Encoding-Agnostic • Stream-Oriented public abstract class Message : IDisposable { public abstract MessageHeaders Headers { get; } public abstract MessageProperties Properties { get; } public abstract MessageVersion Version { get; } public T GetBody<T>() { } static public Message CreateMessage(...) { } public void WriteMessage(XmlWriter writer) { } }

  9. Message: Constructors • Select Action • Select Message Version • Select Formatter • Body as Object, XMLReader • Special Support for Faults, Replies

  10. Factory Factory Factory Listener Listener Listener Channel Channel Channel Channel Channel Channel Agenda: Bindings Binding Binding Factory Listener CreateChannel<T>() AcceptChannel() Channel Channel Send() Receive() Message

  11. C C C B B B A A A Bindings: What Are They? Client Service Message Address Binding Contract (Where) (How) (What)

  12. Bindings: Out of the Box T = Transport Security | S = WS-Security | O = One-Way Only

  13. Bindings: Scenarios • Shipping Channels • Change defaults • Change options • Change set of channels used • Future Channels • Change versions, functionality • Preserve app code • Custom Channels • Binding benefits for any channel

  14. Binding: Object Model public abstract class Binding : IDefaultCommunicationTimeouts { protected Binding() { } public abstract string Scheme { get; set{} } public TimeSpan OpenTimeout { get; set{} } public TimeSpan SendTimeout { get; set{} } public TimeSpan ReceiveTimeout { get; set{} } public TimeSpan CloseTimeout { get; set{} } public virtual IChannelFactory<TChannel> BuildChannelFactory<TChannel>(BindingParameterCollection p) {} public virtual IChannelListener<TChannel> BuildChannelListener<TChannel>(BindingParameterCollection p) {} }

  15. Bindings: Build Your Own • Subclass Binding • An (Internal) Binding Element Collection • Completely Defines Binding, Channel Stack • A Constructor • Loads and Initializes B.E. Collection • A Public API • Simplifies Working With B.E. Collection

  16. Binding: Binding Elements public abstract class BindingElement { protected BindingElement() { } public virtual IChannelFactory<TChannel> BuildChannelFactory<TChannel>(ChannelBuildContext context) {} public virtual IChannelListener<TChannel> BuildChannelListener<TChannel>(ChannelBuildContext context) {} } public class ChannelBuildContext { public ChannelBuildContext() {} public BindingElementCollection UnhandledBindingElements { get; } public BindingParameterCollection BindingParameters { get; } public IChannelFactory<TChan> BuildInnerChannelFactory<TChan>() {} public IChannelListener<TChan> BuildInnerChannelListener<TChan>(){} BindingElement RemoveNextElement(){} }

  17. Bindings: Building Factories • Call “Build()” on First Binding Element • It Builds Its Factory • It Optionally Consumes Binding Elements • It Optionally Consumes Binding Parameters • It Calls “BuildInner()” on BuildContext • It Wires Inner Factory to Itself • It Returns

  18. Factory Factory Factory Listener Listener Listener Channel Channel Channel Channel Channel Channel Agenda: Factories Binding Binding Factory Listener CreateChannel<T>() AcceptChannel() Channel Channel Send() Receive() Message

  19. Factories: In Perspective • Apps use Channels • Factories Create Channels • Factories Share Resources • Per Process • Per Machine Channel Factory Process Manager MachineManager

  20. ICommunicationObject • Implemented by all channels, factories public interface ICommunicationObject : IDisposable { // Created, Opening, Opened, Closing, Closed, Faulted CommunicationState State { get; } event EventHandler Closed; event EventHandler Closing; event EventHandler Faulted; event EventHandler Opened; event EventHandler Opening; // Async Calls Available, Too void Open(); void Close(); void Abort(); }

  21. IChannelManager • Implemented by all channels, factories public interface IChannelManager : ICommunicationObject { MessageVersion MessageVersion { get; } string Scheme { get; } ReadOnlyCollection<IChannel> GetChannels(); T GetProperty<T>() where T : class; }

  22. Factories: The Client • Clients Initiate Connections • One contract, one binding, many addresses • Async methods available public interface IChannelFactory<TChannel> : IChannelFactory { TChannel CreateChannel(string address); TChannel CreateChannel(Uri address); TChannel CreateChannel(EndpointAddress to); } public interface IChannelFactory : IChannelManager { }

  23. Factories: The Service • Services Passively Wait For Connectinons • One address, one binding, many contracts • Async methods available public interface IChannelListener<TChannel> : IChannelListener { void SetUri( /* … */ ); bool WaitForChannel(TimeSpan timeout); TChannel AcceptChannel(); TChannel AcceptChannel(TimeSpan timeout); } public interface IChannelListener : IChannelManager { }

  24. Factory Factory Factory Listener Listener Listener Channel Channel Channel Channel Channel Channel Agenda: Channels Binding Binding Factory Listener CreateChannel<T>() AcceptChannel() Channel Channel Send() Receive() Message

  25. Channels: Three Shapes public interface IOutputChannel : IChannel { void Send(Message message); } public interface IInputChannel : IChannel { Message Receive(); } public interface IDuplexChannel : IInputChannel, IOutputChannel { } public interface IRequestChannel : IChannel { Message Request(Message message); } public interface IReplyChannel : IChannel { IRequestContext ReceiveRequest(); } public interface IRequestContext : IDisposable { Message RequestMessage { get; } void Reply(Message message); }

  26. Channels: Sessions public interface ISession { string Id { get; } } public interface ISessionChannel<SessionType> where SessionType : ISession { SessionType Session { get; } } public interface IInputSession : ISession { } public interface IInputSessionChannel : IInputChannel, ISessionChannel<IInputSession> { }

  27. Channel Families: Transports Channel Channel Channel Transport

  28. Channel Families: Encoders Channel Channel Channel Channel Encoder

  29. Channel Channel Channel Families: Dual Channel DualChannel

  30. Channel Families: Protocols ProtocolChannel EP EP ProtocolChannel TransportChannel TransportChannel M M Message M M

  31. In Summary • Bindings: How You Use The Channel Layer • Bindings Are Easy & Also Extensible • Channels: How Messages Are Exchanged • Channels have Shape, Capabilities, Stacks • Factories: How Channels Are Created

  32. Community Resources • At PDC • For more information, go see • Service Model Internals: COM417, Thursday, 10:00am • XML Messaging: COM326, Thursday, 5:15pm • Building Channels: COM424, Thursday, 3:45pm • WebHost Integration: COM413, Friday, 1:00pm • Ask The Experts table: WCF Internals • I’ll be at COM Track lounge: Thu 3:30-6:30pm, Fri 8:30-11am • After PDC • If you miss some of these sessions, watch the DVD! • MSDN dev center • The WCF newsgroup • Channel 9 tag

  33. © 2005 Microsoft Corporation. All rights reserved. This presentation is for informational purposes only. Microsoft makes no warranties, express or implied, in this summary.

More Related