news in wcf40

Post on 12-May-2015

1.087 Views

Category:

Technology

0 Downloads

Preview:

Click to see full reader

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

News in WCF 4.0

Iaşi, 20 februarie 2010

Florin Cardaşim, www.rms.ro

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

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

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

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

Demo: “Basic”

• Server: ServiceDiscoveryBehavior, UdpDiscoveryEndpoint

• Client: DynamicEndpoint

Client Service

ICalculatorServicenet.tcp://…/CalculatorService/Guid

UdpDiscoveryEndpoint

Demo: “AsyncFind”

• Server: ServiceDiscoveryBehavior, UdpDiscoveryEndpoint

• Client: DiscoveryClient, FindCriteria

Client Service

ICalculatorServicenet.tcp://…/CalculatorService/Guid

UdpDiscoveryEndpointasynchronously

Demo: “Announcements”

Server: ServiceDiscoveryBehavior, UdpAnnouncementEndpoint Client: AnnouncementService, UdpAnnouncementEndpoint

See also the “Configuration” sample

ICalculatorServicenet.tcp://…/CalculatorService/Guid

Service

AnnouncementService

UdpAnnouncementEndpointClient

CalculatorProxy

Demo: “Mex Explorer”

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

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

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

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

Demo: “BasicHttpService” Automatic Help Page

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

Demo: “AspNetCachingIntegration” HTTP Caching Support

Demo: Error handling WebFaultException, WebFaultException<T>

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

… …

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

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

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

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!

Please fill the evaluation form !!!

Thank you very much

Florin Cardasim• florin.cardasim@rms.ro• www.rms.ro• www.codecamp.ro• www.Twitter.com/cardasim

top related