the microsoft technical roadshow 2006 windows communication foundation mike taulty developer &...

28
The Microsoft Technical Roadshow 2006 Windows Communication Windows Communication Foundation Foundation Mike Taulty Mike Taulty Developer & Platform Group Developer & Platform Group Microsoft Ltd Microsoft Ltd [email protected] [email protected] http://mtaulty.com http://mtaulty.com

Post on 15-Jan-2016

220 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: The Microsoft Technical Roadshow 2006 Windows Communication Foundation Mike Taulty Developer & Platform Group Microsoft Ltd Mike.Taulty@microsoft.com

The Microsoft

Technical Roadshow 2006

Windows Communication Windows Communication FoundationFoundation

Mike TaultyMike Taulty

Developer & Platform GroupDeveloper & Platform Group

Microsoft LtdMicrosoft Ltd

[email protected]@microsoft.com

http://mtaulty.comhttp://mtaulty.com

Page 2: The Microsoft Technical Roadshow 2006 Windows Communication Foundation Mike Taulty Developer & Platform Group Microsoft Ltd Mike.Taulty@microsoft.com

Windows Communication Windows Communication FoundationFoundation

•Distributed ApplicationsDistributed Applications•ThemesThemes

•Service OrientationService Orientation•Unifying Programming ModelsUnifying Programming Models•Declarative DevelopmentDeclarative Development

Page 3: The Microsoft Technical Roadshow 2006 Windows Communication Foundation Mike Taulty Developer & Platform Group Microsoft Ltd Mike.Taulty@microsoft.com

Distributed ApplicationsDistributed Applications

‘Client’Message

Message

Services pass messages described by a contractServices pass messages described by a contract

Service may provide metadataService may provide metadataDescribing the contractDescribing the contract

Describing the policy it applies to communicationDescribing the policy it applies to communication

‘Service’

Metadata

Message (SOAP)

Headers: Addressing, Security, etc

Body: Payload

Page 4: The Microsoft Technical Roadshow 2006 Windows Communication Foundation Mike Taulty Developer & Platform Group Microsoft Ltd Mike.Taulty@microsoft.com

Unifying Programming ModelsUnifying Programming Models

ASMX

Interoperable

WSE

Interoperable

Secure

Remoting

Fast

Secure

‘Objects’

COM+

Fast

Secure

Transactions

MSMQ

Queued

Secure

Transactions

Page 5: The Microsoft Technical Roadshow 2006 Windows Communication Foundation Mike Taulty Developer & Platform Group Microsoft Ltd Mike.Taulty@microsoft.com

Scenario – Communication FoundationScenario – Communication Foundation

IIS

Upload Service

Access Service

Windows Service

Admin Service

Submit ServiceViewer

HTTP

Submitter

HTTPS

Authentication

Authorisation

Reliable Messaging

Sessions

MSMQ

Publisher Approver

HTTPS

Authentication

Authorisation

Page 6: The Microsoft Technical Roadshow 2006 Windows Communication Foundation Mike Taulty Developer & Platform Group Microsoft Ltd Mike.Taulty@microsoft.com

What do I send?

Where do I send it?

How should I send it?

Contract

Address

Binding

Mechanics of CommunicationMechanics of Communication

‘Service’‘Client’

Transport?

Encoding?

Security?

Page 7: The Microsoft Technical Roadshow 2006 Windows Communication Foundation Mike Taulty Developer & Platform Group Microsoft Ltd Mike.Taulty@microsoft.com

Mechanics of CommunicationMechanics of Communication

‘Service’‘Client’

EndpointContractBindingAddress

EndpointContractBindingAddress

EndpointContractBindingAddress

Page 8: The Microsoft Technical Roadshow 2006 Windows Communication Foundation Mike Taulty Developer & Platform Group Microsoft Ltd Mike.Taulty@microsoft.com

ContractsContracts[ServiceContract]

public interface INuggetAccess

{

[OperationContract] string[] GetTopics();

}

.NET Interface

<definitions>

<portType>

<operation name=“GetTopics”> …

</portType>

</definitions>

WSDL

svcutil.exe

'Service''Client'

[ServiceContract]

public interface INuggetAccess

{

[OperationContract] string[] GetTopics();

}

public class NuggetAccessService :

INuggetAccess

{ string[] GetTopics() { }

}

Implements

Consumes

request metadata (WSDL)

Page 9: The Microsoft Technical Roadshow 2006 Windows Communication Foundation Mike Taulty Developer & Platform Group Microsoft Ltd Mike.Taulty@microsoft.com

[ServiceContract]

public interface INuggetAccess {

[OperationContract] List<TopicInfo> GetTopics();

}

Service

Contract DetailsContract Details

Message exchange might beMessage exchange might beOne-way, request/response, two-way (Duplex)One-way, request/response, two-way (Duplex)

WCF also supports serialisation models from .NET 2.0WCF also supports serialisation models from .NET 2.0System.Xml.XmlSerialization, System.Runtime.SerializationSystem.Xml.XmlSerialization, System.Runtime.Serialization

[DataContract(Namespace=…)]

public class TopicInfo {

[DataMember]

public int Id

}

Data

[MessageContract]

public class TypedMessage {

[MessageBody]

[MessageHeader]

}

Message

Page 10: The Microsoft Technical Roadshow 2006 Windows Communication Foundation Mike Taulty Developer & Platform Group Microsoft Ltd Mike.Taulty@microsoft.com

Defining a ContractDefining a Contract

DemoDemo

Page 11: The Microsoft Technical Roadshow 2006 Windows Communication Foundation Mike Taulty Developer & Platform Group Microsoft Ltd Mike.Taulty@microsoft.com

Hosting ServicesHosting Services

public class Service :

INuggetAccess

{ string[] GetTopics() { }

}

IIS

<%@ ServiceHost Service='Service' %>

NuggetAccessService.svc

MyApp.exe

ServiceHost host =

new ServiceHost();

host.Open();

References

ServiceHostServiceHost is the key class for hosting is the key class for hostingNeeds manual steps in your host applicationNeeds manual steps in your host application

Automatically done by IIS when provided with a Automatically done by IIS when provided with a .svc .svc filefile

IIS handles additional transports in V7.0IIS handles additional transports in V7.0

Page 12: The Microsoft Technical Roadshow 2006 Windows Communication Foundation Mike Taulty Developer & Platform Group Microsoft Ltd Mike.Taulty@microsoft.com

Hosting a ServiceHosting a Service

DemoDemo

Page 13: The Microsoft Technical Roadshow 2006 Windows Communication Foundation Mike Taulty Developer & Platform Group Microsoft Ltd Mike.Taulty@microsoft.com

BindingsBindings

'Service''Client'

Message Message

Transactions

Reliability

Security

Transactions

Reliability

Security

Channels

Configuration

Configuration

Configuration

Transport Channel (HTTP, TCP, etc)Configuration

Page 14: The Microsoft Technical Roadshow 2006 Windows Communication Foundation Mike Taulty Developer & Platform Group Microsoft Ltd Mike.Taulty@microsoft.com

BindingsBindingsBinding

Transactions

Reliability

Security

Channels

Configuration

Configuration

Configuration

Transport Channel (HTTP, TCP, etc)Configuration

Creates a configured set of channelsCreates a configured set of channelsStandard bindings in the frameworkStandard bindings in the framework

Build your own custom bindings out of new/existing Build your own custom bindings out of new/existing channelschannels

Page 15: The Microsoft Technical Roadshow 2006 Windows Communication Foundation Mike Taulty Developer & Platform Group Microsoft Ltd Mike.Taulty@microsoft.com

Standard Framework BindingsStandard Framework Bindings

Pre-built set in the Pre-built set in the frameworkframework

WS-I Basic ProfileWS-I Basic Profile

WS-* on HTTPWS-* on HTTP

TCPTCP

Named PipesNamed Pipes

MSMQMSMQ

PeerPeer

Configure/code your own Configure/code your own as a ‘custom’ bindingas a ‘custom’ binding

Binding

Transactions

Reliability

Security

Channels

Configuration

Configuration

Configuration

TransportConfiguration

Page 16: The Microsoft Technical Roadshow 2006 Windows Communication Foundation Mike Taulty Developer & Platform Group Microsoft Ltd Mike.Taulty@microsoft.com

Configuring a BindingConfiguring a Binding

DemoDemo

Page 17: The Microsoft Technical Roadshow 2006 Windows Communication Foundation Mike Taulty Developer & Platform Group Microsoft Ltd Mike.Taulty@microsoft.com

Securing Message ExchangesSecuring Message Exchanges

Transfer SecurityTransfer Security

AuthenticationAuthentication

PrivacyPrivacy

IntegrityIntegrity

Secure the transport or secure the messageSecure the transport or secure the message

AuthorisationAuthorisation

PrincipalPermissionPrincipalPermission attribute attribute

More flexible More flexible OperationRequirement OperationRequirement

Complete custom claims processing via XSIComplete custom claims processing via XSI

AuditingAuditing

Client

Message

Service

Page 18: The Microsoft Technical Roadshow 2006 Windows Communication Foundation Mike Taulty Developer & Platform Group Microsoft Ltd Mike.Taulty@microsoft.com

Securing Message ExchangesSecuring Message Exchanges

ScenarioScenario

Page 19: The Microsoft Technical Roadshow 2006 Windows Communication Foundation Mike Taulty Developer & Platform Group Microsoft Ltd Mike.Taulty@microsoft.com

Reliable Messaging (!= Queues)Reliable Messaging (!= Queues)

Client and Service running at the same timeClient and Service running at the same time

Can do exactly once, in orderCan do exactly once, in order

Can control the amount of ‘buffering’Can control the amount of ‘buffering’

Using WS-ReliableMessagingUsing WS-ReliableMessaging

Client Service

Message 1

Intermediary

Ack: Msg1

Message 2

Page 20: The Microsoft Technical Roadshow 2006 Windows Communication Foundation Mike Taulty Developer & Platform Group Microsoft Ltd Mike.Taulty@microsoft.com

Instancing, Concurrency, SessionsInstancing, Concurrency, Sessions

Service classes can be instantiatedService classes can be instantiated

Singleton, per-call, per-session, shareableSingleton, per-call, per-session, shareable

Service code can be eitherService code can be either

Single-threaded, re-entrant or multi-threadedSingle-threaded, re-entrant or multi-threaded

Client

Service

Singleton

Message B

Message C

Message A

Page 21: The Microsoft Technical Roadshow 2006 Windows Communication Foundation Mike Taulty Developer & Platform Group Microsoft Ltd Mike.Taulty@microsoft.com

Instancing, Concurrency, SessionsInstancing, Concurrency, Sessions

Service classes can be instantiatedService classes can be instantiated

Singleton, per-call, per-session, shareableSingleton, per-call, per-session, shareable

Service code can be eitherService code can be either

Single-threaded, re-entrant or multi-threadedSingle-threaded, re-entrant or multi-threaded

Client

Service

Single Call

Single Call

Single Call

Message B

Message C

Message A

Page 22: The Microsoft Technical Roadshow 2006 Windows Communication Foundation Mike Taulty Developer & Platform Group Microsoft Ltd Mike.Taulty@microsoft.com

Instancing, Concurrency, SessionsInstancing, Concurrency, Sessions

Service classes can be instantiatedService classes can be instantiated

Singleton, per-call, per-session, shareableSingleton, per-call, per-session, shareable

Service code can be eitherService code can be either

Single-threaded, re-entrant or multi-threadedSingle-threaded, re-entrant or multi-threaded

Client

Service

Per Session

Message B

Message Asession

Per SessionMessage C

Page 23: The Microsoft Technical Roadshow 2006 Windows Communication Foundation Mike Taulty Developer & Platform Group Microsoft Ltd Mike.Taulty@microsoft.com

Reliable Messaging & SessionsReliable Messaging & Sessions

ScenarioScenario

Page 24: The Microsoft Technical Roadshow 2006 Windows Communication Foundation Mike Taulty Developer & Platform Group Microsoft Ltd Mike.Taulty@microsoft.com

Transactional MessagingTransactional Messaging

Client ServiceMessage

WS-AT, OleTx

Distributed

Transaction

Coordinator

Page 25: The Microsoft Technical Roadshow 2006 Windows Communication Foundation Mike Taulty Developer & Platform Group Microsoft Ltd Mike.Taulty@microsoft.com

Queued Messaging (== Queues)Queued Messaging (== Queues)

Client and Service can have different lifetimesClient and Service can have different lifetimes

Relies on the MSMQ transportRelies on the MSMQ transport

Transactional, secure, in-order, etcTransactional, secure, in-order, etc

Client ServiceMessage

Queue

MessageMessageMessageMessage

Page 26: The Microsoft Technical Roadshow 2006 Windows Communication Foundation Mike Taulty Developer & Platform Group Microsoft Ltd Mike.Taulty@microsoft.com

Queued MessagingQueued Messaging

ScenarioScenario

Page 28: The Microsoft Technical Roadshow 2006 Windows Communication Foundation Mike Taulty Developer & Platform Group Microsoft Ltd Mike.Taulty@microsoft.com

© 2006 Microsoft Corporation. All rights reserved. This presentation is for informational purposes only.MICROSOFT MAKES NO WARRANTIES, EXPRESS OR IMPLIED, IN THIS SUMMARY.