Microsoft MVP INETA Speaker Blog httpkeitheldernetblog Twitter httptwittercomkeithelder Podcast httpdeepfriedbytescom Demystifying Windows Communication Foundation Originally from Ripley Ms ID: 560207
Download Presentation The PPT/PDF document "Keith Elder" is the property of its rightful owner. Permission is granted to download and print the materials on this web site for personal, non-commercial use only, and to display it on your personal computer provided you do not modify the materials and that you retain all copyright notices contained in the materials. By downloading content from our website, you accept the terms of this agreement.
Slide1
Keith ElderMicrosoft MVPINETA SpeakerBlog: http://keithelder.net/blog/Twitter: http://twitter.com/keithelderPodcast: http://deepfriedbytes.com
Demystifying Windows Communication FoundationSlide2
Originally from Ripley, Ms
Raised on a small farm
Yes I have milked a cow, slopped the chickens and fed the hogs
Home of the 2
nd
largest flea market in the USSlide3
Modelled During the 80'sSlide4Slide5
Quicken Loans
$500! Cash!Slide6
About Quicken LoansOriginally founded in 1985 as Rock Financial by Dan GilbertGrew to one of the largest independent mortgage banks in the country1998 IPO1999 Launched Rockloans.Com
1999 Intuit, Inc (makers of TurboTax and Quicken) purchased Rock Financial.
July 2002 Dan Gilbert purchased Quicken Loans back from Intuit. Retained Quicken Loans branding and marketing initiatives.
5000 employees
Largest online retail home loan lenderSlide7
Deep Fried Bytes is an audio talk show with a Southern flavor hosted by technologists and developers Keith Elder and Chris Woodruff. The show discusses a wide range of topics including application development, operating systems and technology in general. Anything is fair game if it plugs into the wall or takes a battery.
http://deepfriedbytes.com Slide8
AgendaHow We Got HereASMX vs WCF ThrowdownWCF ContractsServiceDataMessage
Bindings
Security
Reliability
Declarative
SummarySlide9
From Objects to Services
Polymorphism
Encapsulation
Subclassing
Message-based
Schema+Contract
Binding via Policy
1980s
2000s
Interface-based
Dynamic Loading
Runtime Metadata
1990s
Object-Oriented
Service-Oriented
Component-BasedSlide10
The Challenge Radically Simplifying Distributed Application Development
Development of connected systems
remains costly and frustrating
Different programming models for different tasks
Need for security and reliable messaging
Interoperability with applications on other platforms
Productive service-oriented programming model neededSlide11
Windows Communication Foundation
Unified framework for
rapidly building
service-oriented applicationsSlide12
What Does WCF Replace?Slide13
DEMOSlide14
Our Current asmx services investment vs wcfSlide15
Smart Client
Java Client
Service
User’s Desktop
Open Form
UserControl
UserControl
Event
Event
Event
ASMX ChallengeSlide16
Current ASMX Web ServicesSlide17
What’s So Different About WCFSlide18
Understanding WCF principlesSlide19
Services and Clients
Client
Service
Message
MessageSlide20
Endpoints
Client
Service
Message
Endpoint
Endpoint
EndpointSlide21
Address, Binding, Contract
Client
Service
Message
Address
Binding
Contract
(Where)
(How)
(What)
Endpoint
A
B
C
A
B
C
Endpoints
A
B
CSlide22
WCF Architecture: Messaging Runtime
Transport
Encoder
Protocol(s)
Transport
Encoder
Protocol(s)
Client
Dispatcher
Service
Contract
and
Behaviors
Binding
AddressSlide23
ContractsThe whatSlide24
Three Types of ContractsSlide25
Ways to TalkOne Way: Datagram-style deliveryRequest-ReplyImmediate Reply on same logical threadDuplex
Reply “later” and on backchannel (callback-style)
Client
Service
One Way
Request-Reply
Duplex (Dual)Slide26
Service ContractsWhat does your service do?Slide27
Service Contractusing System.ServiceModel; [ServiceContract]
public interface ICalculate
{
[OperationContract]
double Add( double a, double b);
[OperationContract]
double Subtract( double a, double b);
} Slide28
Service Contract: OneWay[ServiceContract]public interface IOneWayCalculator{
[OperationContract(
IsOneWay=true
)]
void StoreProblem (ComplexProblem p);
}Slide29
Service Contract: Duplex Asymmetric[ServiceContract(Session=true,
CallbackContract=typeof(ICalculator
Results
)
]
public interface ICalculatorProblems
{
[OperationContract(IsOneWay=true)]
void SolveProblem (ComplexProblem p);
}
public interface ICalculatorResults
{
[OperationContract(IsOneWay=true)]
void Results(ComplexProblem p);
}Slide30
Service Contract: Duplex Symmetric[ServiceContract(Session=true,
CallbackContract=typeof(IC
hat
)
]
public interface IChat
{
[OperationContract(IsOneWay=true)]
void Talk(string text);
}Slide31
DEMO – SERVICE CONTRACTSlide32
Data contractsWhat object data needs to flow back and forth?Slide33
Data Contract[DataContract]public class ComplexNumber
{
[DataMember]
public double Real = 0.0D;
[DataMember]
public double Imaginary = 0.0D;
public ComplexNumber(double r, double i)
{
this.Real = r;
this.Imaginary = i;
}
}Slide34
Message contractsDefines the mapping between the type and a SOAP envelopeSlide35
Message Contract[MessageContract]public class ComplexProblem
{
[MessageHeader]
public string operation;
[MessageBody]
public ComplexNumber n1;
[MessageBody]
public ComplexNumber n2;
[MessageBody]
public ComplexNumber solution;
// Constructors…
}Slide36
bindingsSlide37
Bindings & Binding ElementsTransport
IPC
MSMQ
Custom
TCP
HTTP
Protocol
Encoders
.NET
TX
Custom
Security
Reliability
Binding
HTTP
TX
Security
Reliability
Text
Text
Binary
CustomSlide38
Standard BindingsBinding
Interop
Security
Session
TX
Duplex
BasicHttpBinding
BP 1.1
N, T
N
N
n/a
WSHttpBinding
WS
M
, T, X
N
, T, RS
N
, Yes
n/a
WSDualHttpBinding
WS
M
RS
N
, Yes
Yes
WSFederationBinding
Federation
M
N
, RS
N
, Yes
No
NetTcpBinding
.NET
T
, M
T
,RS
N
, Yes
Yes
NetNamedPipeBinding
.NET
T
T
, N
N
, Yes
Yes
NetPeerTcpBinding
Peer
T
N
N
Yes
NetMsmqBinding
.NET
T
, M, X
N
N
, Yes
No
MsmqIntegrationBinding
MSMQ
T
N
N
, Yes
n/a
N = None | T = Transport | M = Message | B = Both | RS = Reliable SessionsSlide39
Bindings & Behaviors: SecurityService
C
B
A
C
B
A
Client
A
B
C
C
B
A
Be
Be
Bindings Insert Claims in Messages
Behaviors Implement Security GatesSlide40
Claims based end-to-end securitySecure end-to-end message exchangesSecure access to resourcesRecord resource access requestsX509, Username/Password, Kerberos, SAML, custom credentialsMessage security
Confidentiality and integrity
Transport or message level
Access to resources
Authentication and authorization
Feature Overview
SecuritySlide41
DEMO - BINDINGSSlide42
Bindings & Behaviors: TransactionsService
C
B
A
C
B
A
Client
A
B
C
C
B
A
Be
Be
Bindings Flow Transactions
Behaviors AutoEnlist and AutoCompleteSlide43
ServiceC
B
A
C
B
A
Client
A
B
C
C
B
A
Bindings provide Session and Guarantees
Bindings & Behaviors: Reliable SessionsSlide44
End-to-end Reliable messagingIn-order guaranteesExactly once guaranteesTransport-Independent SessionsIntegration with ASP.NET Sessions in IIS-Hosted compatibility modeTransactions
Guaranteed atomic success or failure across services
Feature Overview
Reliability and TransactionsSlide45
Code vs. ConfigSlide46
Defining Endpoints<?xml version="1.0" encoding="utf-8" ?><configuration xmlns="http://schemas.microsoft.com/.NetConfiguration/v2.0
">
<system.serviceModel>
<services>
<service serviceType="CalculatorService">
<endpoint address="Calculator"
bindingSectionName="basicProfileBinding"
contractType="ICalculator" />
</service>
</services>
</system.serviceModel>
</configuration>Slide47
Configuring Bindings<endpoint address="Calculator" bindingSectionName="basicProfileBinding"
bindingConfiguration="Binding1"
contractType="ICalculator" />
<bindings>
<basicProfileBinding>
<binding configurationName="Binding1"
hostnameComparisonMode="StrongWildcard"
transferTimeout="00:10:00"
maxMessageSize="65536"
messageEncoding="Text"
textEncoding="utf-8"
</binding>
</basicProfileBinding>
<
/bindings>Slide48
Custom Bindings<bindings> <customBinding>
<binding configurationName="Binding1">
<reliableSession bufferedMessagesQuota="32"
inactivityTimeout="00:10:00"
maxRetryCount="8"
ordered="true" />
<http
s
Transport manualAddressing="false"
maxMessageSize="65536"
hostnameComparisonMode="StrongWildcard"/>
<textMessageEncoding maxReadPoolSize="64"
maxWritePoolSize="16"
messageVersion="Default"
encoding="utf-8" />
</binding>
</customBinding>
</bindings>Slide49
DEMO – MULTIPLE BINDINGSSlide50
Application
Service Model
Messaging
Hosting
Environments
ASP.NET
WPF
WinForm
NT Service
COM+
TCP
Channel
HTTP
Channel
Queue
Channel
Secure
Channel
Reliable
Channel
Instance
Behavior
Throttling
Behavior
Type Integ.
Behavior
Transaction
Behavior
Concurrency
Behavior
Error
Behavior
Metadata
Behavior
Binary
Encoder
Text/XML
Encoder
…
…
…
WCF Summary
WASSlide51
WCF SummaryWCF is the future of distributed computingIt combines the best of all existing Microsoft distributed computing stacksIt uses WS-* standards for interoperability and .NET value-add for performance and integration with existing solutionsWCF is available for Windows Vista, Windows XP SP2, Windows Server 2003, Windows Server 2008