In this PDC session, Ed Pinto, Program Manager at Microsoft, reviewed the many new additions to WCF 4.0. REST and WF services were not covered in this session, as they are covered in other sessions.
- Default Endpoints – The WCF team took feedback in and decided to prefer “Convention over Configuration”. This means that if an endpoint is not explicitly configured for your service, a default endpoint will be created whose configuration is set by convention.
- Default Bindings – It is now possible to specify an unnamed binding configuration, which becomes the default binding configuration for that particular binding.
- Default Behaviors – Services and Endpoint pick up default behaviors from higher in the configuration hierarchy if on other behaviour is specified.
- “ServiceActivations” configuration element – Allows configuring a WCF service to run in IIS without an svc file.
Windows Server AppFabric
As was already described, AppFabric (formerly codenamed “Dublin”) is a set of integrated technologies for building, scaling, and managing web and composite apps that run on IIS. AppFabric ships as part of the 2010 launch wave and is now available in Beta.
Monitoring WCF Apps
WCF now support Event Tracing for Windows (ETW) which can be configured via the standard way, and AppFabric provides an Event Collector which inserts events into a Monitoring DB which can be configured via the AppFabric tools.
Message Pump as a Service – Routing Service
Since WCF 3.0 many developers (including Sasha and myself) needed to implement a message pump (or message router) which basically takes messages from an input channel and puts them on an output channel. This is useful for various scenarios which include:
- Basic Message Routing
- Protocol Bridging
- Service Aggregation
WCF 4.0 now ships with a Routing Service which fully supports message routing, thus decoupling the client from the server. This service supports:
- Basic message routing based on a configured filter table.
- Protocol bridging including transport conversion, SOAP version conversion etc.
- Security decoupling and impersonation.
- Error handling – configure alternate service endpoints in case of failure.
- Transactions – flow transactions and control of transactional queue reads (as opposed to the destructive reads done in WCF 3.0 and 3.5 which delete the message when it is read).
Discovery is the ability to publish a service’s endpoint metadata and discover services using well defined criteria. This is very useful both during design time to find available service and during runtime to allow reduced configurations, location agility and dynamic/self-healing applications. This service is an implementation of WS-Discovery and is standard interoperable.
Discovery comes in a couple of modes:
- Ad-hoc Discovery – No central discovery server, and discovery is performed via multicast messages.
- Managed Discovery – A discovery proxy is used to facilitate discovery. This suppresses the use for multicasting, and it also allows us to expose our own service repository to all clients in a standard way.
WCF 4.0 provides a full implementation for the ad-hoc mode and all of tools and contracts for building your own custom managed discovery mechanism. “DiscoveryProxy” is the base class required for creating a discovery service.
Making a service discoverable is very simple – just add a “ServiceDescoveryBehavior” and a discovery endpoint (such as “UdpDiscoveryEndpoint”) and you’re good to go. On the client side all you have to do is use a “DynamicEndpoint” instance, use it to create an instance of your service and you’re done!
Adding announcements to services is just an easy – all you have to do is add an announcement endpoint and that’s it. This gives you a very impressive ability for the client to respond to service availability on the network.
The Bottom Line
WCF 4.0 sure adds many required features which were missing in WCF 3.0 and 3.5, and enhances some areas which were already present. This session makes a great job showcasing these abilities and is highly recommended for viewing if you’re new to WCF 4.0.