Geeks With Blogs ///<summary>Just a lot of random technical stuff, really.</summary>

As I noted earlier, I recently converted a Visual Studio 2005 solution with WCF clients to Visual Studio 2008.  After making some additional changes and running the application, I started getting errors instantiating the WCF clients.  The message -- that the contract for my WCF client couldn't be found in the list of endpoints in my config -- was unexpected since I re-created my WCF clients with the same name (and in the same namespace) as before.

After a quick inquiry with my colleague (and brilliant WCF programmer, I might add) David Pallmann, he pointed me to the ConfigurationName property of the ServiceContract attribute.

Sure enough, VS2005 (via svcutil.exe) appeared to generate ConfigurationName values that matched the entire interface typename (Namespace1.Namespace2.Etc.ServiceClass.Interface).  However, VS 2008 appears to shorten this to only include the class and interface (ServiceClass.Interface).  Without referring to the svcutil.exe documentation, I'm guessing you can provide this value, and the WCF tools bundled with VS 2008 must be shortening the name.

I updated my config files, and the WCF clients worked again (having found the matching endpoint configurations now).  Not a big deal, although I'm again disturbed that the upgrade to VS2008 required code changes.

What I find really interesting is that the ConfigurationName property of the ServiceContract attribute seems to map to the endpoint Contract value in the config.  Shouldn't the value of Contract be the type of the contract we're implementing for this client, and not necessarily configurable?  Seems like a misnomer to me.  What's also unusual, IMHO, is that the ConfigurationName property of the ServiceContract attribute doesn't map to the Name property of the client endpoint.  Weird.

Listening to: idobi Radio

Posted on Friday, May 9, 2008 3:32 PM WCF , SOA | Back to top

Comments on this post: WCF Client Endpoint Contract Changes Between VS2005 and VS2008

No comments posted yet.
Your comment:
 (will show your gravatar)

Copyright © David Barrett | Powered by: