Presentation is loading. Please wait.

Presentation is loading. Please wait.

Windows Communication Foundation (WCF)

Similar presentations


Presentation on theme: "Windows Communication Foundation (WCF)"— Presentation transcript:

1 Windows Communication Foundation (WCF)
Jim Fawcett CSE775 – Distributed Objects Spring 2007

2 References Introducing WCF, David Chappell, Using three diagrams from this reference Programming Indigo, David Pallmann, Microsoft Press, 2005 Pro WCF, Peiris and Mulder, Apress, 2007

3 What is WCF? Integration of several Microsoft Technologies:
Web services (ASMX) Web service extensions (WSE) WS-Security WS-Reliability WS-Addressing .Net Remoting MSMQ messaging COM+ Transactions

4 Chappell, ibid, pg 14

5 Channel Model WCF supports three types of channel activity:
Asysnchronous one-way Request, wait for reply Full duplex two-way

6 Channel Shapes IOutputChannel IInputChannel IRequestChannel
7/29/2018 3:33 AM Channel Shapes IOutputChannel IInputChannel IRequestChannel IReplyChannel 3 types of Channel Shapes (BEANBAGS) 1. Datagram: Messages are “fire and forget”. (THROW BEANBAG OVER HEAD) This is like sending a postcard in the mail (could get lost). Or like UDP. This is a building block for Messaging since arbitrary protocols can be built on top of it. 2. Request-Response: (THROW BACK AND FORTH BETWEEN KENNY AND YASSER) Common MEP. RPC, browser GETs, etc. 3. Duplex: bi-directional communication. (KEEP THROWING IN RANDOM ORDER) This is like speaking to a co-worker, etc. * Also Session-ful variants of each of these protocols. * Factories can support multiple shapes For Request-Response you get an IRequestContext instead of a Message (this comment should go in later slides though, doesn’t matter for the overview) IDuplexChannel ©2005 Microsoft Corporation. All rights reserved. This presentation is for informational purposes only. Microsoft makes no warranties, express or implied, in this summary.

7 Endpoints and Channels
7/29/2018 3:33 AM 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(); ©2005 Microsoft Corporation. All rights reserved. This presentation is for informational purposes only. Microsoft makes no warranties, express or implied, in this summary.

8 Structure Service Contract Binding Address
Service contract – RPC Interface Data contract – Type serialization Message contract – Soap message Binding Transport – HTTP, TCP, MSMQ, … Channel type – one-way, duplex, request-reply Encoding – XML, binary, MTOM (msg trans optim mech) WS-* protocols – WS-Security, … Address net.tcp://someOtherURI net.msmq://stillAnotherURI

9 Chappell, ibid, pg 25

10 Channel Interfaces public interface IOutputChannel : IChannel { void Send(Message msg); } public interface IInputChannel : IChannel { Message Receive(); } public interface IDuplexChannel : IOutputChannel, IInputChannel {} public interface IRequestChannel : IChannel { Message Request(Message msg); } public interface IReplyChannel : IChannel { IRequestContext ReceiveRequest(); } public interface IRequestContext : Idisposable { Message RequestMessage { get; } void Reply(Message msg); }

11 Service Contract ServiceHost Language=“C#” Service=“MyService” %> [ServiceContract] public interface IMyService { [OperationContract] string Hello( string name); } public class MyService : IMyService { public string Hello(string name) { return “Hello “ + name; } }

12 Hosts WCF Services can be hosted in:
Internet Information Services (IIS) Very similar to web services Windows services Exposing windows service in style of WS Console and Winform applications New style for socket like functionality

13 Monitoring Services Message Logging WCF Performance counters
Calls, CallsOutsantding, CallsErrored, … SecurityCallsNotAuthenticated, … TxCommitted, TxAborted, … RMSessionsStarted, RMSessionsFaulted, … Windows Management Instrumentation (WMI), a COM technology

14 Other Topics WCF Security Credentials and claims (evidence)
Transport-level security Message-level security Federated security model Authorization Auditing

15 Reliable Messaging ReliableSession enabled MSMQ Binding
Implemented at the SOAP level not TCP packet Very similar to TCP functionality Messages not sent are held in a Transfer Window cache Will have problems with large messages MSMQ Binding Needs microsoft platforms on both ends Supports store and forward

16 Other Features WCF Supports transactions ACID properties Atomicity
composite operations treated as a unit Consistency Operations succeed or the system is returned to prior state Isolation Each transaction is independent and isolated from other transactions Durability If an operation succeeds it becomes durable, e.g., committed to a database or other persistant store

17 Conclusion Convergence of programming models Flexible hosting options
Desktop Application Web Application Windows Services Flexible hosting options Flexible abstractions


Download ppt "Windows Communication Foundation (WCF)"

Similar presentations


Ads by Google