Thursday, September 25, 2008

WCF service Reference metadata

I was trying earlier today to connect to a WCF service that I had created months ago, and when I created the client, I actually had to create the service reference by hand (this was before VS 2008 had come out).

Today I tried to add the reference directly, and I got the following error message:

Metadata contains a reference that cannot be resolved

which confused me, but the solution turned out to be very easy to fix. Look inside the app.config for your WCF service, and find the <serviceBehaviors> section. Inside there, simply add the node:
<serviceMetadata />

additionally, you need to add another endpoint to your service that obeys the IMetadataExchange contract. This endpoint only needs to look like:

<endpoint address="mex" binding="mexTcpBinding" contract="IMetadataExchange" />

and I was able to reference my service with no issues.

Labels: ,

0 Comments:

Post a Comment

Subscribe to Post Comments [Atom]

<< Home