1 / 24

Windows Communication Foundation (“Indigo”): A Deep Dive Into Extending The Channel Layer

Windows Communication Foundation (“Indigo”): A Deep Dive Into Extending The Channel Layer . Kenny Wolf, Software Development Engineer Yasser Shohoud, Lead Program Manager COM424 Microsoft Corporation. What’s in it for you?. Enable new transports (e.g. SMTP, UDP)

nell
Download Presentation

Windows Communication Foundation (“Indigo”): A Deep Dive Into Extending 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. Windows Communication Foundation (“Indigo”): A Deep Dive Into Extending The Channel Layer Kenny Wolf, Software Development Engineer Yasser Shohoud, Lead Program Manager COM424 Microsoft Corporation

  2. What’s in it for you? • Enable new transports (e.g. SMTP, UDP) • Integrate with other systems (e.g. Java RMI) • Implement custom infrastructure protocols Channel extensibility is an opportunity for component vendors

  3. Endpoints and Channels ServiceHost host = new ServiceHost(typeof(MyService)); Uri address = new Uri(“net.tcp://kennyw2/Service/endpoint”); Binding binding = new NetTcpBinding(); Type contract = typeof(IMyContract); host.AddEndpoint(address, binding, contract); host.Open();

  4. Proxy Dispatcher Protocol Channel(s) Transport Channel Protocol Channel(s) Transport Channel Channel Types

  5. Proxy Dispatcher Protocol Channel(s) Transport Channel Protocol Channel(s) Transport Channel Layered Extensibility Service Model Extensibility (local only) Channel Extensibility (affects the wire)

  6. Outline • Writing a TCP transport • Writing a chunking protocol channel • Wrap up and Q&A

  7. IOutputChannel IInputChannel IRequestChannel IReplyChannel IDuplexChannel IDuplexChannel Channel Shapes

  8. Client Service Sockets vs. Channels (Client) Channel Socket CreateChannel(Uri); channel.Open() new Socket(); socket.Connect(IP, port) channel.Send(Message) socket.Send(byte[]) Throws CommunicationException or TimeoutException Throws SocketException socket.Close() channel.Close() Exception contract Unit of Data Transferred Shutdown Addressing <Envelope><Body>...</Envelope> my.tcp://kennyw2:808/myService/ {0x08, 0xAF, 0x6D, 0xBE, 0xEF, ...} (172.30.16.60, 808)

  9. Unit of Data TransferMessage  Bytes • MessageEncoder • Text, Binary, and MTOM ship with “Indigo” • BufferManager • Proper tuning can yield large (>10%) performance increases ArraySegment<byte> WriteMessage(Message, maxSize, BufferManager) Message ReadMessage(ArraySegment<byte>, BufferManager) void WriteMessage(Message message, Stream stream) Message ReadMessage(Stream stream, int maxSizeOfHeaders) BufferManager.CreateBufferManager(long maxBufferPoolSize,int maxSize)

  10. Unit of Data TransferFraming Message Bytes • Need to encapsulate certain information outside of the SOAP message • Byte Length of Data • Content Type & Uri for Channel • Method: 4 byte size, then data 19 text/xml my.tcp://kennyw2/a/ 386 8 channel.Open() CreateChannel(“my.tcp://kennyw2/a/”) channel.Send(message)

  11. Client Service Sockets vs. Channels (Service) Channel Socket new Socket(); listenSocket.Bind(IP, port); listenSocket.Listen(); BuildChannelListener<T>(Uri); listener.Open(); IChannel = listener.AcceptChannel(); Socket = listenSocket.Accept() socket.Receive(byte[]) Message = channel.Receive() socket.Close() channel.Close() Unit of Data Transferred Shutdown Accept Addressing

  12. Building a TCP Transport

  13. Outline • Writing a TCP transport • Writing a chunking protocol channel • Wrap up and Q&A

  14. What We Will Show You

  15. Managing Inner Channel State Open • Open inner channel • Wait for pending sends, if any • Drain session, if applicable • Close inner channel Close Abort • Abort inner channel

  16. Handling Inner Channel Events Opened Opening Useful for reacting to state transitions when your code is not driving the channel Closing Closed Faulted When inner channel faults, your channel should recover or fault

  17. Message • Message is the unit of I/O in Indigo • Based on XML InfoSet • Consists of headers and body • Message Headers • Buffered, random access collection • Used to implement infrastructure protocols • Message Body • Forward-only cursor • Used to carry application data

  18. Working With Message • Reading body content • Creating messages using BodyWriter • Reading and writing headers • Creating messages using XmlDictionaryReader • Custom messages

  19. App Code WS-Policy Configuring ChannelsBinding Element Configuration ChunkingBindingElement Properties Chunking Configuration Section Policy Import .config

  20. Custom Behavior BindingParameters BindingElement ChannelFactory ChannelListener Configuring ChannelsCustom Behaviors

  21. Using The Chunking Channel

  22. Key Take Aways • Write custom channels when you need to • Change what goes on the wire • Integrate with arbitrary systems • Enable new transports • Channel extensibility is an opportunity for component vendors Please fill out the evaluation We want to know what you think!

  23. Community Resources • At PDC • COM429: A Deep Dive into Extending the Service Model Layer (Fri 10:30am) • COM413: IIS and Windows Communication Foundation (“Indigo”): Hosting Services (Fri 1pm) • Labs: COMHOL29 • Ask The Experts table: ExtendingWCF • COM Track lounge: We’ll be there Thu 5-6pm, Fri 8:30-noon • After PDC • If you missed this related session, watch it on the DVD • COM424: WCF: A Deep Dive into Extending the Channel Layer • MSDN dev center: http://msdn.microsoft.com/webservices/ • MSDN Forum: Windows Communication Foundation ("Indigo") • http://www.kennyw.com/indigo/ • http://blogs.msdn.com/yassers/ • Channel 9 tag: http://channel9.msdn.com/tags/Indigo/

  24. © 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