Download - News In Wcf40
![Page 1: News In Wcf40](https://reader036.vdocuments.net/reader036/viewer/2022081519/55510a5bb4c90572478b5511/html5/thumbnails/1.jpg)
News in WCF 4.0
Iaşi, 20 februarie 2010
Florin Cardaşim, www.rms.ro
![Page 2: News In Wcf40](https://reader036.vdocuments.net/reader036/viewer/2022081519/55510a5bb4c90572478b5511/html5/thumbnails/2.jpg)
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](https://reader036.vdocuments.net/reader036/viewer/2022081519/55510a5bb4c90572478b5511/html5/thumbnails/3.jpg)
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](https://reader036.vdocuments.net/reader036/viewer/2022081519/55510a5bb4c90572478b5511/html5/thumbnails/4.jpg)
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](https://reader036.vdocuments.net/reader036/viewer/2022081519/55510a5bb4c90572478b5511/html5/thumbnails/5.jpg)
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](https://reader036.vdocuments.net/reader036/viewer/2022081519/55510a5bb4c90572478b5511/html5/thumbnails/6.jpg)
Demo: “Basic”
• Server: ServiceDiscoveryBehavior, UdpDiscoveryEndpoint
• Client: DynamicEndpoint
Client Service
ICalculatorServicenet.tcp://…/CalculatorService/Guid
UdpDiscoveryEndpoint
![Page 7: News In Wcf40](https://reader036.vdocuments.net/reader036/viewer/2022081519/55510a5bb4c90572478b5511/html5/thumbnails/7.jpg)
Demo: “AsyncFind”
• Server: ServiceDiscoveryBehavior, UdpDiscoveryEndpoint
• Client: DiscoveryClient, FindCriteria
Client Service
ICalculatorServicenet.tcp://…/CalculatorService/Guid
UdpDiscoveryEndpointasynchronously
![Page 8: News In Wcf40](https://reader036.vdocuments.net/reader036/viewer/2022081519/55510a5bb4c90572478b5511/html5/thumbnails/8.jpg)
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](https://reader036.vdocuments.net/reader036/viewer/2022081519/55510a5bb4c90572478b5511/html5/thumbnails/9.jpg)
Demo: “Mex Explorer”
• Juval Lowy, IDesign.Net• A wonderfull WCF book: “Programming WCF Services”
![Page 10: News In Wcf40](https://reader036.vdocuments.net/reader036/viewer/2022081519/55510a5bb4c90572478b5511/html5/thumbnails/10.jpg)
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](https://reader036.vdocuments.net/reader036/viewer/2022081519/55510a5bb4c90572478b5511/html5/thumbnails/11.jpg)
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](https://reader036.vdocuments.net/reader036/viewer/2022081519/55510a5bb4c90572478b5511/html5/thumbnails/12.jpg)
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](https://reader036.vdocuments.net/reader036/viewer/2022081519/55510a5bb4c90572478b5511/html5/thumbnails/13.jpg)
Demo: “BasicHttpService” Automatic Help Page
• helpEnabled = true - default• http://localhost:8000/help
![Page 14: News In Wcf40](https://reader036.vdocuments.net/reader036/viewer/2022081519/55510a5bb4c90572478b5511/html5/thumbnails/14.jpg)
Demo: “AspNetCachingIntegration” HTTP Caching Support
![Page 15: News In Wcf40](https://reader036.vdocuments.net/reader036/viewer/2022081519/55510a5bb4c90572478b5511/html5/thumbnails/15.jpg)
Demo: Error handling WebFaultException, WebFaultException<T>
![Page 16: News In Wcf40](https://reader036.vdocuments.net/reader036/viewer/2022081519/55510a5bb4c90572478b5511/html5/thumbnails/16.jpg)
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](https://reader036.vdocuments.net/reader036/viewer/2022081519/55510a5bb4c90572478b5511/html5/thumbnails/17.jpg)
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](https://reader036.vdocuments.net/reader036/viewer/2022081519/55510a5bb4c90572478b5511/html5/thumbnails/18.jpg)
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](https://reader036.vdocuments.net/reader036/viewer/2022081519/55510a5bb4c90572478b5511/html5/thumbnails/19.jpg)
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](https://reader036.vdocuments.net/reader036/viewer/2022081519/55510a5bb4c90572478b5511/html5/thumbnails/20.jpg)
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](https://reader036.vdocuments.net/reader036/viewer/2022081519/55510a5bb4c90572478b5511/html5/thumbnails/21.jpg)
Please fill the evaluation form !!!
Thank you very much
Florin Cardasim• [email protected]• www.rms.ro• www.codecamp.ro• www.Twitter.com/cardasim