news in wcf40

21
News in WCF 4.0 Iaşi, 20 februarie 2010 Florin Cardaşim, www.rms.ro

Upload: florin-cardasim

Post on 12-May-2015

1.086 views

Category:

Technology


0 download

DESCRIPTION

These are the slides for the "News in WCF4.0" presentation from 20th of feb 2010 in Iasi at Ramada (details at codecamp.ro)

TRANSCRIPT

Page 1: News In Wcf40

News in WCF 4.0

Iaşi, 20 februarie 2010

Florin Cardaşim, www.rms.ro

Page 2: News In Wcf40

Agenda

News that we’ll cover today

• Simplified Configuration

• Service Discovery• REST Support• Routing Service

News for you to explore

• Workflow Services• Miscellaneous

Advanced Features• DataContractResolver• ReceiveContext• ByteStreamMessageEncodi

ngBindingElement• ETW-based Tracing

Page 3: News In Wcf40

Simplified Configuration

It’s easier to get started with WCF 4.0• Default endpoints, binding configurations, behavior

configurations• Hosting in IIS without .svc file

… but for scenarios other than “common” WCF configuration is still a non-trivial task

DEMO

Page 4: News In Wcf40

Service Discovery

WS-* WS-ServiceDiscovery SOAP-based protocol for dynamically discovering the

location of service endpoints at runtime

Adhoc mode Direct client-service multicast messages over UDP

Managed mode A discovery proxy “manages” the discoverable service

endpoints

Page 5: News In Wcf40

Adhoc Service Discovery

• Multicast UDP messages• Search based on criteria (ex: contract name, version

etc)• Services answer directly• Services may “announce” online/offline• ONLY on local subnet

Client ServicesClientClients

ServicesServices

search answer

UDP multicast

announce online/offline

Page 6: News In Wcf40

Demo: “Basic”

• Server: ServiceDiscoveryBehavior, UdpDiscoveryEndpoint

• Client: DynamicEndpoint

Client Service

ICalculatorServicenet.tcp://…/CalculatorService/Guid

UdpDiscoveryEndpoint

Page 7: News In Wcf40

Demo: “AsyncFind”

• Server: ServiceDiscoveryBehavior, UdpDiscoveryEndpoint

• Client: DiscoveryClient, FindCriteria

Client Service

ICalculatorServicenet.tcp://…/CalculatorService/Guid

UdpDiscoveryEndpointasynchronously

Page 8: News In Wcf40

Demo: “Announcements”

Server: ServiceDiscoveryBehavior, UdpAnnouncementEndpoint Client: AnnouncementService, UdpAnnouncementEndpoint

See also the “Configuration” sample

ICalculatorServicenet.tcp://…/CalculatorService/Guid

Service

AnnouncementService

UdpAnnouncementEndpointClient

CalculatorProxy

Page 9: News In Wcf40

Demo: “Mex Explorer”

• Juval Lowy, IDesign.Net• A wonderfull WCF book: “Programming WCF Services”

Page 10: News In Wcf40

Managed Service Discovery

• Services “announce” Disco Proxy• Clients “ask” Disco Proxy• More flexible, reduces multicasts traffic

Client ServicesClientClients

ServicesServices

Discovery Proxy

announce online/offline answer

search

Page 11: News In Wcf40

Demo: “DiscoveryProxy”

DiscoveryProxy: DiscoveryProxy, DiscoveryEndpoint, AnnouncementEndpoint

Service: ServiceDescoveryBehavior, AnnouncementEndpoint Client: DiscoveryClient, DiscoveryEndpoint

AnnouncementEndpointnet.tcp://localhost:9021/Announcement

DiscoveryEndpointnet.tcp://localhost:8001/Probe

DiscoveryProxy

Client Service

ICalculatorServicenet.tcp://…/CalculatorService/Guid

Page 12: News In Wcf40

REST Improvements Automatic Help Page HTTP Caching Support Error handling enhancements

WebFaultException, WebFaultException<T>

Various API enhancements

• Until now CodePlex “Rest Starter Kit”• Now in .NET 4.0

Page 13: News In Wcf40

Demo: “BasicHttpService” Automatic Help Page

• helpEnabled = true - default• http://localhost:8000/help

Page 14: News In Wcf40

Demo: “AspNetCachingIntegration” HTTP Caching Support

Page 15: News In Wcf40

Demo: Error handling WebFaultException, WebFaultException<T>

Page 16: News In Wcf40

Routing Service

When do we need a routing service?• Centralized security boundary• Load balancing• Protocol bridging• Content based routing for licensing, prioritization, versioning etc

ServicesServices

Services

Routing ServiceOne-way

Request-replyDuplex

ClientClientClients

Message Filter Endpoint

action==http://localhost/myservice1/op1

myservice1

No filter All endpoints

… …

Page 17: News In Wcf40

Routing Service Supported communication patterns

Filters

Supported Message Exchange Patterns Multicast Interface

Request Reply, Sessionful Request Reply No IRequestReplyRouter

OneWay Yes ISimplexDatagramRouter

Sessionful OneWay Yes ISimplexSessionRouter

Sessionful Duplex Yes IDuplexSessionRouter

Filter On MessageFilter

Action ActionMessageFilter

Address header AddressMessageFilter

Address header – longest prefix matching AddressPrefixMessageFilter

Endpoint Name EndpointNameMessageFilter

No Filter – matches everything MatchAllMessageFilter

Logical And of two filters StrictAndMessageFilter

XPath expression XPathMessageFilter

Custom Custom

Page 18: News In Wcf40

Demo: “HelloRoutingService”

Client connects to RouterService Calls are routed to ICalculatorEP based on the MatchAll

filter The routing service has a proxy to the CalculatorService

Message Filter Endpoint

MatchAll ICalculatorEP

Client RoutingService

Internal Proxy CalculatorService

IRequestReplyRouterEP

ICalculatorEP

IMetadataExchangeEP

IMetadataExchangeEP

Page 19: News In Wcf40

Demo: RouterBridgingAndErrorHandling

Client connects to RouterService via HTTP Calls are routed to deadDestination based on the MatchAll

filter deadDestination is not reachable so go to realDestination

Message Filter Endpoint

MatchAll deadDestination

HTTPClient RoutingServic

e

Internal Proxy CalculatorService

IRequestReplyRouterEP

realDestination

TCP

deadDestination

Page 20: News In Wcf40

References

MSDN article by Aaron Skonnard, Pluralsight.com Articles by Michele Bustamante, dasblonde.net Articles by Juval Lowy, IDesign.net Channel9 Ed Pinto at PDC 2009, microsoftpdc.com/ VS2010 Training Kit

Get Visual Studio 2010 RC now and play with it!

Page 21: News In Wcf40

Please fill the evaluation form !!!

Thank you very much

Florin Cardasim• [email protected]• www.rms.ro• www.codecamp.ro• www.Twitter.com/cardasim