Windows Communication Foundation
Download
Report
Transcript Windows Communication Foundation
Windows Communication Foundation
Jason Mauer
Microsoft Corporation
November 10, 2005
Agenda
What is Windows Communication Foundation (WCF)?
Anatomy
Programming Model
Features
Demos (sprinkled throughout)
2
18 July 2015
What is Windows Communication Foundation?
Messaging framework of WinFX
WinFX = next generation Windows API
Service-oriented programming model
Managed API built with .NET
Implements WS-I standards
Formerly (and popularly :) known as “Indigo”
3
18 July 2015
WCF Anatomy
Endpoint
Service
Channel
Behavior
4
18 July 2015
WCF Anatomy: Endpoint
Basic unit of communication
Represented by ServiceEndpoint class
Made up of three components
Address
Binding
Contract
5
18 July 2015
The ABCs of WCF
Address
Defines where the endpoint is
Binding
Defines how the endpoint communicates
Contract
Defines what the endpoint communicates
6
18 July 2015
The ABCs of WCF
7
WSDL
Section
WCF
Term
a.
Where?
service
address
b.
How?
binding
binding
c.
What?
portType
contract
18 July 2015
The ABCs of WCF: Address
Address components
URI
Identity
Headers (optional)
Headers differentiate endpoints with the same URI
8
18 July 2015
The ABCs of WCF: Binding
Made up of binding elements that describe how the
endpoint communicates
Transport protocol
TCP, HTTP, MSMQ, named pipes, etc
Encoding
text, Message Transmission Optimization Mechanism (MTOM),
binary
Security
asymmetric, symmetric, transport
Other aspects like message reliability
9
18 July 2015
Binding Example
BasicProfileHttpBinding
Name, namespace uniquely identify binding in service’s
metadata
HTTP transport, text encoding
10
18 July 2015
Predefined Bindings
Interoperable
BasicHttpBinding – suitable for WS-Basic Profile Web services
(including ASMX)
WSHttpBinding – for non-duplex services
WSDualHttpBinding – for duplex service contracts or
communication through SOAP intermediaries
Optimized
NetTcpBinding – for cross-machine communication
NetProfileNamedPipeBinding – for on-machine communication
Message Queues
NetMsmqBinding – for communication with WCF applications
MsmqIntegrationBinding – for existing MSMQ applications
11
18 July 2015
The ABCs of WCF: Contract
ContractDescription describes WCF contracts and their
operations
OperationDescription describes operation aspects
One way, request/reply, etc
MessageDescription objects describe messages that make up
an operation
12
18 July 2015
Contract Definition
Attribute-based
Data Contract definition
Opt-in
Supports interfaces and classes
Independent of class access modifiers
Backward compatibility for existing serialization
definitions
.NET Serialization
XML Serialization
13
18 July 2015
WCF Anatomy: Services, Clients, and Channels
Service
A program that exposes a collection of endpoints to
communicate with the outside world
Client
A program that exchanges messages with one or more
endpoints using channels
Channel
An abstraction of the connection between the client and an
endpoint (and its associated messaging pipeline)
14
18 July 2015
Services and Channels: Separated at Birth
ServiceDescription
15
ChannelDescription
18 July 2015
WCF Architecture
CLR Type
Integration
Transaction
Behavior
CLR Type
Integration
Transaction
Behavior
Security
Channel
Transport
Security
Channel
Transport
Service
Code
Instancing
Behavior
Service Model Layer
Influences and adds to
the programming
model based on
incoming messages
16
18 July 2015
Messaging Layer
Moves messages back
and forth and adds
transfer semantics
(channels)
WCF Anatomy: Behaviors
Augments runtime functionality of service/channel
Throttling is one example
Behaviors implemented through interfaces
Services: IServiceBehavior
Channels: IChannelBehavior
17
18 July 2015
Hosting WCF
IIS Hosting
HTTP only
Windows Service
Windows Activation Service (WAS)
Vista/Longhorn Server feature
Provides improved manageability
Self Hosting
ServiceHost class
18
18 July 2015
WCF Programming Model
Simple abstractions with full control under the surface
Support for custom bindings, transports, encodings, etc
Built on CLR type system
Adorn types and methods with attributes
Extensive support for configuration
Make changes to services after deployment
19
18 July 2015
WCF Programming: SvcUtil.exe
Command-line utility to generate ServiceModel code and
metadata
Similar to wsdl.exe from .NET Framework
20
18 July 2015
WCF Features
Security
Reliable Messaging
Queues
Transactions
Compatibility
“InfoCard”
21
18 July 2015
WCF Features: Security
Transfer Security
Integrity – detecting message tampering
Confidentiality – keeping messages private
Authentication – verifying claimed identity
Two modes of support
Transport mode: uses transport-level protocol (like HTTPS); only point-topoint secure
Message mode: uses WS-Security; less efficient but secure from end to end
Standards support
22
SOAP Message Security (OASIS)
WS-Trust
WS-SecureConversation
WS-Federation
WS-SecurityPolicy
18 July 2015
WCF Features: Security
Access Control
Supports legacy CLR-based security
PrincipalPermissionAttribute
Provides an extensible claims-based authorization model
Auditing
Logging security-related events to Windows event log
23
18 July 2015
WCF Features: Reliable Messaging
Provides for SOAP messages what TCP provides for IP
packets
Ensures messages are exactly once
Handles lost messages and duplicates
Optional ordered delivery
End-to-end reliability (vs. transport reliability of TCP)
24
18 July 2015
WCF Features: Queues
Leverages Microsoft Message Queuing (MSMQ) as a
transport
Enables loosely coupled applications and disconnected
operations
25
18 July 2015
WCF Features: Transactions
Takes advantage of System.Transactions in .NET 2.0
Supports WS-AtomicTransaction
26
18 July 2015
WCF Features: Compatibility
COM+
Extend COM+ components as Web services
Service derived from COM+ interface
Surrogate support if more control over service contract is needed
COM
Moniker support (GetObject) for usage of WCF services from
COM-based applications
Web Services Enhancements (WSE) 3.0
.NET v1.x WS-I support add-on library
27
18 July 2015
WCF Features: “InfoCard”
MS implementation of an Open Identity Metasystem
Users have portfolio of identities for different contexts
Goal is consistency and interoperability between current
and future methods of identification
Built on WS-I standards
WS-Trust
WS-MetadataExchange
WS-SecurityPolicy
28
18 July 2015
WCF Availability
WinFX Beta 1 available now
For .NET Framework v2.0 Beta 2
WinFX Beta 2 coming soon
Supports RTM of .NET Framework v2.0
WinFX RTM with Windows Vista
also supported on XP and Server 2003
29
18 July 2015
Other Goodies in WinFX
Windows Presentation Foundation
Graphics subsystem
Vector-based, hardware accelerated
Declarative programming model
Windows Workflow Foundation
Workflow engine
Upcoming versions of BizTalk and SharePoint are built upon it
Declarative programming model
30
18 July 2015
Resources
MSDN
WinFX SDK Library
http://winfx.msdn.microsoft.com/library/
Windows Vista Developer Center
http://msdn.microsoft.com/windowsvista/
Windows SDK Library
http://windowssdk.msdn.microsoft.com/library/
WCF Team Blogs
Don Box
http://pluralsight.com/blogs/dbox/
Steve Maine
http://hyperthink.net/blog/
Richard Turner
http://blogs.msdn.com/richardt/
31
18 July 2015
In Closing
Q&A
Reach me at [email protected]
Thanks!
32
18 July 2015