Академический Документы
Профессиональный Документы
Культура Документы
WCF Overview
Peter Himschoot
peter@u2u.net
Blog:http://www.u2u.info/Blogs/Peter
Agenda
• Shed some light on the many .NET versions
2
• Understand WCF
– Why?
– Concepts
– Code
• Some features
– Client Callbacks
– Messaging
– JSON
A History of .NET
Why?
Questions We Hear a Lot…
6
• System.Web.Services (ASMX)
– XML, HTTP, SOAP/WSDL/XSD
– Focused on interop
• System.EnterpriseServices (COM+)
– DCOM RPC, TCP
– Focused on high-performance transaction processing
• System.Messaging (MSMQ)
– Focused on durable transacted messaging
• System.Runtime.Remoting (.NET Remoting)
– HTTP or TCP, SOAP or Binary
– Tightly coupled to .NET type system
WCF’s goals
• Unify the developer experience for building distributed apps
– Consistent conceptual model across varying scenarios
– Common set of idioms + metaphors that work everywhere
• Scenario parity with the existing stacks
– Critical for adoption
• Architectural foundation for the future
– WS-* (.NET 3.0)
– Web-style services (.NET 3.5)
– Workflow Services (.NET 3.5)
– Distributed durable workflows
– Large-scale pub/sub
– <your scenario here>
WCF Fundamentals
• Windows Communication Foundation (WCF)
9
Concepts
Clients and Services
Client Service
Message
11
Endpoints
Client Service
Message Endpoint
Endpoint Endpoint
Endpoint
12
Address, Binding, Contract
Client Service
Message A B C
C B A A B C
A B C
Endpoint
13
Some Standard Bindings
BasicHttpBinding BP 1.1 TM
WsHttpBinding WS TM
WsDualHttpBinding WS TM
NetTcpBinding .NET TM
NetNamedPipesBinding .NET TM
NetMsmqBinding MSMQ TM
NetPeerTcpBinding Peer TM
T = Transport Security | M = Message Security | O = One-Way Only
15
Response = f (Request)
[DataContract]
• Define the message
20
Deeper Example
21
[FaultContract]
• Operations can return errors (Fault msg)
22
– Contract
– Binding
– Address
Web.config with endpoint
28
View in Browser…
29
Add Meta Data
• Added through behavior
30
Hosting Options
• IIS
31
– Console, Windows
– ASP.NET, Silverlight
–…
Create the Client
• Create client
33
From
.config
37
Client Callbacks
WCF Message Patterns
38
One Way
Client Service
Request-Reply
Duplex (Dual)
• One Way:
– Datagram-style delivery
• Request-Reply
– Immediate Reply on same logical thread
• Duplex
– Reply “later” and on backchannel (callback-style)
Contract: Callback
• Client can pass callback interface
39
Messaging
43