Presentation is loading. Please wait.

Presentation is loading. Please wait.

Windows Communication Foundation António Cruz Freelancer (SAPO/PT.COM)

Similar presentations


Presentation on theme: "Windows Communication Foundation António Cruz Freelancer (SAPO/PT.COM)"— Presentation transcript:

1

2 Windows Communication Foundation António Cruz Freelancer (SAPO/PT.COM) antonio.cruz@co.sapo.pt

3 Agenda What Is the Windows Communication Foundation? How Does It Work? How Do I Use and Deploy It? Bindings Addresses Contracts Transactions Security Management Integration and Extensibility

4 What Is the Windows Communication Foundation? Many confusing and complicated options Remotin g COM D/COM COM+ MSMQ WSE ASMX One simple choice that is always the best option Windows Communication Foundation Yesterday: Now:

5 Agenda What Is the Windows Communication Foundation? How Does It Work? How Do I Use and Deploy It? Bindings Addresses Contracts Transactions Security Management Integration and Extensibility

6 How Does It Work? Data Service Model Address, Binding, Contract, and Behaviors Channel Layer Protocols, Encoders, and Transports Messages Metadata

7 Agenda What Is the Windows Communication Foundation? How Does It Work? How Do I Use and Deploy It? Bindings Addresses Contracts Transactions Security Management Integration and Extensibility

8 How Do I Use It? [ServiceContract] public interface IMyInterface { [OperationContract] public MyOutputType MyMethod(MyInputType myData); } Service Contract Definition <service name=“MyService”> <endpoint address=“MyAddress” binding=“netTcpBinding” contract=“IMyInterface” /> Endpoint Configuration [ServiceBehavior(InstanceContextMode=Single] public class MyService: IMyInterface { public MyOutputType MyMethod(MyInputType myData) { //my code … } Contract Implementation (Service Type)

9 How do I Deploy It? For HTTP services on Windows XP ® SP2 & WS2K3 For any service on Windows Vista ® and Windows Server ® “Longhorn” Proven reliability, scalability, and security Requires a.svc file to identify the Service Type Web Host within IIS: Self-Host within any.NET process: Available for any service Console apps, windowed apps,.NET NT Services …

10 Building a Simple Service and Client

11 Agenda What Is the Windows Communication Foundation? How Does It Work? How Do I Use and Deploy It? Bindings Addresses Contracts Transactions Security Management Integration and Extensibility

12 All About Bindings You can choose a pre-defined binding: <endpoint name=“MyService” address=“MyAddress” binding=“netTcpBinding” contract=“IMyInterface” /> NetPeerTcpBinding NetMsmqBinding NetNamedPipeBinding NetTcpBinding WSHttpBinding BasicHttpBinding Binding.NET Peer  Peer.NET .NET via MSMQ.NET .NET across processes Secure, reliable duplexed.NET .NET across processes Secure, reliable duplexed Basis for WS-* interop Supports WS-Security, WS-RM, WS-Tx Basic Profile 1.1 Interop and Integration w/ASMX Purpose

13 You can customize a pre-defined binding <service name=“MyService”> <endpoint address=“MyAddress” binding=“wsHttpBinding” bindingConfiguration=“MyReliableBinding” contract=“IMyInterface” /> <reliableSession enabled=“true” ordered=“true” All About Bindings

14 You can define custom bindings <service name=“MyService”> <endpoint address=“MyAddress” binding=“customBinding” bindingConfiguration=“MyCustomBinding” contract=“IMyInterface” /> All About Bindings

15 Reliability

16 Agenda What Is the Windows Communication Foundation? How Does It Work? How Do I Use and Deploy It? Bindings Addresses Contracts Transactions Security Management Integration and Extensibility

17 All About Addresses The scheme portion of an address corresponds to the transport protocol: The schemes clearly indicate which protocols have been standardized. NetNamedPipeBinding NetMsmqBinding NetTcpBinding BasicHttpBinding, WSHttpBinding Binding net.pipe://… net.msmq://… net.tcp://… http://... Scheme

18 All About Addresses An endpoint address is relative to a base address: For a Web-Hosted service, the base address is that of its virtual directory <service name=“MyService”> <endpoint address=“MyEndpointAddress” binding=“wsHttpBinding” bindingConfiguration=“MyReliableBinding” contract=“IMyInterface” />

19 Agenda What Is the Windows Communication Foundation? How Does It Work? How Do I Use and Deploy It? Bindings Addresses Contracts Transactions Security Management Integration and Extensibility

20 All About Contracts Look again at this service contract: [ServiceContract] public interface IMyInterface { [OperationContract] public MyOutputType MyMethod(MyInputType myData); } How do MyOutputType and MyInputType get serialized into messages? Serialization is done by DataContractSerializer by default Handles “built-in”.NET Framework types automatically User-defined types require Data Contracts: [DataContract] public class MyDataContract {[DataMember] public string MyField; } [ServiceContract] [XmlSerializerFormat] public interface IMyInterface Can opt for the older, slower XmlSerializer:

21 WCF in a Nutshell AddressBinding BehaviorContract HTTP Transport TCP Transport NamedPipe Transport MSMQ Transport Custom Transport WS-Security Protocol WS-RM Protocol WS-Coord 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 operation

22 Agenda What Is the Windows Communication Foundation? How Does It Work? How Do I Use and Deploy It? Bindings Addresses Contracts Transactions Security Management Integration and Extensibility

23 WCF Transaction Managers Lightweight Transaction Manager (LTM) Single AppDomain, single durable resource, multiple volatile, one service, maximum performance. Distributed Transaction Coordinator (DTC) Transactions across process and network, uses OleTx or WS-AT, multiple services, flows client and services transactions, system service. Kernel Transaction Manager (KTM) Vista/Longhorn only, transactional file system (TxF) & registry (TxR), uses LTM (multiple volatile resources, one service).

24 Transactions

25 Agenda What Is the Windows Communication Foundation? How Does It Work? How Do I Use and Deploy It? Bindings Addresses Contracts Transactions Security Management Integration and Extensibility

26 All About Security Authentication A message may incorporate a security token The security token has claims about the sender The type of security token is configured with the binding Built-in support for these token types: Windows (Kerberos or NTLM) Username (a user name & a password) X.509 certificate CardSpace tokens SAML tokens Can add support for custom token types Authorization Authorization configured w/ServiceAuthorizationBehavior Authorization options: For users authenticated using Windows tokens: Principal Permissions ASP.NET Role Provider For users authenticated using any sort of token: a ServiceAuthorization manager

27 Message-Level Security

28 Agenda What Is the Windows Communication Foundation? How Does It Work? How Do I Use and Deploy It? Bindings Addresses Contracts Transactions Security Management Integration and Extensibility

29 All About Management Instruments (Data & Control Points) Configuration System Tools Configuration Editor WMI Provider CIM Studio ScriptOMatic PowerShell Tracing and Logging Trace Viewer Performance Counters PerfMon Management Interface PowerShell CmdLet Management Model Microsoft Management Model Designer Integrated Management Microsoft Operations Manager 2005 Management Pack

30 Agenda What Is the Windows Communication Foundation? How Does It Work? How Do I Use and Deploy It? Bindings Addresses Contracts Transactions Security Management Integration and Extensibility

31 All About Integration COMWCF Service Monikers WCFCOM+ Use COMSVCConfig.exe to wrap COM+ app w/WCF endpoint WCF WSE 3 WCF For HTTP, use properly configured WSHttpBinding For TCP, custom TCP transport sample on NETFX3.com Remoting WCF WSE 2 WCF Remoting WCF WSE 2 Upgrade Remoting & WSE 2 components to WCF ASMX WCF ASMX Configure WCF components to use BasicHttpBinding ClientService Integration Strategy

32 All About Extensibility Client Code parameters Typed Proxy Channel Transport Channel byte[] Encoder Service Type parameters Dispatcher Channel Transport Channel byte[] Encoder Contract Message Inspector Custom Channel Custom Transport Custom Encoder Custom Transport Custom Channel Operation Invoker Message Formatter Parameter Inspector Message Formatter WSDL Exporter Instance Provider * Added by configuring the runtime with behaviors * Added by adding binding elements to the binding Message Inspector Parameter Inspector Operation Selector

33 REST and POX extensibility

34 Summary What Is the Windows Communication Foundation? How Does It Work? How Do I Use and Deploy It? Bindings Addresses Contracts Transactions Security Management Integration and Extensibility

35 António Cruz Freelancer (SAPO/PT.COM) antonio.cruz@co.sapo.pt Links http://wcf.netfx3.com/ http://blogs.msdn.com/drnick/ http://www.idesign.net/ http://www.arquitecturadesoftware.org/blogs/antoniocruz


Download ppt "Windows Communication Foundation António Cruz Freelancer (SAPO/PT.COM)"

Similar presentations


Ads by Google