IMetaDataExchange could not be found in the list of contracts implemented by the service
Asked Answered
A

3

11

I have searched the web for resolution of this error, but everything I have found suggests what I have is correct.

Maybe someone could take a look and spot an obvious mistake I just cannot see.

I have a windows service, hosting two contracts:

  1. IConfigurationService
  2. IConfigurationAdminService

The admin service inherits from the standard service as I want both contracts to implement the basic methods.

The problem is I can host the services fine, until I try and add a MEX.

Then I get the following exception:

The contract name 'IMetaDataExchange' could not be found in the list of contracts implemented by the service 'ConfigurationWCFService'.

And this is my config, everything is configured by config, nothing done through code.

<system.serviceModel>
    <bindings>
      <netTcpBinding>
        <binding name="tcpBinding" maxBufferSize="2147483647" maxReceivedMessageSize="2147483647">
          <readerQuotas maxStringContentLength="2147483647" maxArrayLength="2147483647" />
          <security mode="None" />
        </binding>
      </netTcpBinding>
    </bindings>
    <services>
      <service behaviorConfiguration="serviceBehavior" name="BrightsideGroup.Repa.Configuration.ConfigurationWCFService">
        <endpoint address="ConfigurationService" binding="netTcpBinding"
          bindingConfiguration="tcpBinding" name="tcpConfiguration" contract="BrightsideGroup.Repa.Configuration.IConfigurationWCFService" />
        <endpoint binding="mexHttpBinding" address="mex" name="mex" contract="IMetaDataExchange" />
        <host>
          <baseAddresses>
            <add baseAddress="net.tcp://GD01316:9123/Repa" />
            <add baseAddress="http://GD01316:8123/Repa" />
          </baseAddresses>
        </host>
      </service>
      <service behaviorConfiguration="serviceBehavior" name="BrightsideGroup.Repa.Configuration.ConfigurationWCFAdminService">
        <endpoint address="ConfigurationAdminService" binding="netTcpBinding"
          bindingConfiguration="tcpBinding" name="tcpConfigurationAdmin"
          contract="BrightsideGroup.Repa.Configuration.IConfigurationAdminWCFService" />
        <endpoint binding="mexHttpBinding" address="mex" name="mex" contract="IMetaDataExchange" />
        <host>
          <baseAddresses>
            <add baseAddress="net.tcp://GD01316:9124/Repa" />
            <add baseAddress="http://GD01316:8124/Repa" />
          </baseAddresses>
        </host>
      </service>
    </services>
    <behaviors>
      <serviceBehaviors>
        <behavior name="serviceBehavior">
          <serviceMetadata httpGetEnabled="true" />
        </behavior>
      </serviceBehaviors>
    </behaviors>
  </system.serviceModel>
Aleen answered 6/10, 2010 at 11:10 Comment(0)
G
12

You have the casing incorrect - the WCF configuration is case-sensitive

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

Note that the "D" is not capitalized in IMetadataExchange You can double check the syntax on MSDN.

Gorton answered 6/10, 2010 at 11:23 Comment(1)
Thank you. I knew it had to be something simple!! COuld not see the forest for the trees!! thank you.Aleen
S
6

I am using NetTcpBinding for all. In my case I was having the same issue and resolved it by adding:

(a) a behaviourConfiguration="" to the mex endpoint

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

(b) a behaviourConfiguration="mex" to the service definition:

<services>
    <service name="AcmeService" behaviourConfiguration="mex">

(c) The behaviour entry

<behaviors>
    <serviceBehaviors>
        <behaviour name="mex">
            <serviceDebug includeExceptionDetailInFaults="false"/>
            <serviceMetadata />
        </behavior>
     </serviceBehaviors>
 </behaviors>
Sub answered 22/1, 2013 at 20:1 Comment(0)
G
2

I hope the following link may provide you the help.

And also try adding the following :

<endpoint address="mex" binding="mexTcpBinding" contract="IMetadataExchange"/>
Goulash answered 6/10, 2010 at 11:46 Comment(2)
Marked down as the question had already been answered, and this would not work as it is the wrong protocol, I am using http, not net.tcp.Aleen
Since i saw an entry for net.tcp in base address, i presumed that you are using that too. Also, by the time i answered the question, i didn't get the alert about the existence of another answer. Thank you.Goulash

© 2022 - 2024 — McMap. All rights reserved.