我已经在网上搜索了这个错误的解决方法,但我发现的一切都表明我所拥有的是正确的。
也许有人可以看一看并发现一个我无法看到的明显错误。
我有一个Windows服务,主持两个合同:
管理服务继承自标准服务,因为我希望两个合同都实现基本方法。
问题是我可以很好地托管服务,直到我尝试添加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>
答案 0 :(得分:12)
您的外壳不正确 - WCF配置区分大小写
<endpoint address="mex"
binding="mexHttpBinding"
contract="IMetadataExchange" />
请注意,IMetadataExchange
中的“D”未大写。您可以仔细检查syntax on MSDN。
答案 1 :(得分:6)
我正在使用NetTcpBinding。在我的情况下,我遇到了同样的问题并通过添加:
来解决它(a)对mex端点的行为配置=“”
<endpoint address="mex"
binding="mexTcpBinding"
contract="IMetadataExchange"
behaviourConfiguration="" />
(b)对服务定义的行为配置=“mex”:
<services>
<service name="AcmeService" behaviourConfiguration="mex">
(c)行为条目
<behaviors>
<serviceBehaviors>
<behaviour name="mex">
<serviceDebug includeExceptionDetailInFaults="false"/>
<serviceMetadata />
</behavior>
</serviceBehaviors>
</behaviors>
答案 2 :(得分:2)
我希望following link可以为您提供帮助。
并尝试添加以下内容:
<endpoint address="mex" binding="mexTcpBinding" contract="IMetadataExchange"/>