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

jimplode picture jimplode · Oct 6, 2010 · Viewed 17.5k times · Source

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>

Answer

Philip Rieck picture Philip Rieck · Oct 6, 2010

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.