IMetaDataExchange could not be found in the list of contracts implemented by the service
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:
- IConfigurationService
- 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 c开发者_如何学Pythonontracts 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>
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.
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>
I hope the following link may provide you the help.
And also try adding the following :
<endpoint address="mex" binding="mexTcpBinding" contract="IMetadataExchange"/>
精彩评论