在服务实现的合约列表中找不到 IMetaDataExchange
我已经在网上搜索了此错误的解决方案,但我发现的所有内容都表明我所拥有的内容是正确的。
也许有人可以看一下并发现一个我看不到的明显错误。
我有一个 Windows 服务,托管两个合约:
- IConfigurationService
- IConfigurationAdminService
管理服务继承自标准服务,因为我希望两个合约都实现基本方法。
问题是我可以很好地托管服务,直到我尝试添加 MEX。
然后我得到以下异常:
在服务“ConfigurationWCFService”实现的合约列表中找不到合约名称“IMetaDataExchange”。
这是我的配置,一切都是通过配置配置的,没有通过代码完成。
<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>
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 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>
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
您的大小写不正确 - WCF 配置区分大小写
请注意,IMetadataExchange 中的“D”不是大写的 您可以仔细检查 MSDN 上的语法。
You have the casing incorrect - the WCF configuration is case-sensitive
Note that the "D" is not capitalized in
IMetadataExchange
You can double check the syntax on MSDN.我正在使用 NetTcpBinding 进行所有操作。就我而言,我遇到了同样的问题,并通过添加以下内容解决了该问题:
(a)在 mex 端点中添加了一个behaviorConfiguration=""
(b)在服务定义中添加了一个behaviorConfiguration="mex":(
c)行为条目
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
(b) a behaviourConfiguration="mex" to the service definition:
(c) The behaviour entry
我希望以下链接可以为您提供帮助。
并尝试添加以下内容:
I hope the following link may provide you the help.
And also try adding the following :