BT

David Pallmann’s WCF Tips

| by Hartmut Wilms Follow 0 Followers on Sep 28, 2007. Estimated reading time: 2 minutes |

David Pallmann has published a series of WCF Tips. The tips are assembled in terms of design patterns, which are grouped by aspects of developing WCF providers and consumers.

The series discusses the following aspects:

  1. Service Interface Design
  2. Service Class Design
  3. Service Hosting
  4. Configuration
  5. Infrastructure
  6. Instrumentation
  7. Clients

Concerning service interfaces Dave advices that all operations of a single service interface should share a common theme, should be coarse-grained and prefer asynchronous messaging. Service metadata, at least WSDLs and XSDs, should be registered within a service catalog/registry. Document or data structures should address the consumer's needs instead of representing internals of a service. This advice goes in line with Pat Helland's "Data on the Outside vs. Data on the inside".

Keep service interface and service implementation apart from each other and be very explicit about your implementation choices, especially the instancing model. Avoid stateful services and write thread-safe code.

Choose your service host according to your needs, not in favour of your likings or the model, which is familiar to you. In any case don't rely on the default settings, which are not appropriate for real-world scenarios:

Learn the appropriate knobs to turn to make WCF perform for you. Don’t assume the defaults are best, in many cases they aren’t. [...] Some of the default settings in WCF are great. Some of them aren’t. Some of them, in the name of being secure out-of-box, prevent you performing useful work!

Although any SOA should be driven by business needs, you have to choose the right infrastructure in order to accommodate your non-functional requirements. The main topics of infrastructure services are loose-coupling and discovery of services. Some examples of infrastructure or technical services are:

  • Directory of services
  • Message router
  • Message transformation
  • Rules service
  • Workflow host
  • Integration adapter
  • Activity monitor

Remember to enable instrumentation of WCF services by configuring services to publish metadata and report status information. The first is accomplished by publishing a WS-MetadataExchange endpoint and the latter by enabling Windows Management Instrumentation (WMI) within your service configuration.

Finally David points out that you shouldn't rely on generated proxy clients. The default generation does not implement error handling, which is essential for robust client code.

This assortments of tips is by no means complete, but it offers a good starting point and a minimal checklist for WCF service development. Seemingly the most important points are service configuration and service discovery. Useful discovery services are missing and metadata publishing is disabled by default. The configuration defaults are not appropriate for a real-world context, they have rather been chosen "in the name of shipping 'securely by default'".

Rate this Article

Adoption Stage
Style

Hello stranger!

You need to Register an InfoQ account or or login to post comments. But there's so much more behind being registered.

Get the most out of the InfoQ experience.

Tell us what you think

Allowed html: a,b,br,blockquote,i,li,pre,u,ul,p

Email me replies to any of my messages in this thread
Community comments

Allowed html: a,b,br,blockquote,i,li,pre,u,ul,p

Email me replies to any of my messages in this thread

Allowed html: a,b,br,blockquote,i,li,pre,u,ul,p

Email me replies to any of my messages in this thread

Discuss

Login to InfoQ to interact with what matters most to you.


Recover your password...

Follow

Follow your favorite topics and editors

Quick overview of most important highlights in the industry and on the site.

Like

More signal, less noise

Build your own feed by choosing topics you want to read about and editors you want to hear from.

Notifications

Stay up-to-date

Set up your notifications and don't miss out on content that matters to you

BT