在服务实现的合约列表中找不到 IMetaDataExchange

发布于 2024-09-25 23:59:11 字数 2629 浏览 1 评论 0原文

我已经在网上搜索了此错误的解决方案,但我发现的所有内容都表明我所拥有的内容是正确的。

也许有人可以看一下并发现一个我看不到的明显错误。

我有一个 Windows 服务,托管两个合约:

  1. IConfigurationService
  2. 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:

  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>

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

违心° 2024-10-02 23:59:11

您的大小写不正确 - WCF 配置区分大小写

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

请注意,IMetadataExchange 中的“D”不是大写的 您可以仔细检查 MSDN 上的语法

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.

倾城°AllureLove 2024-10-02 23:59:11

我正在使用 NetTcpBinding 进行所有操作。就我而言,我遇到了同样的问题,并通过添加以下内容解决了该问题:

(a)在 mex 端点中添加了一个behaviorConfiguration=""

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

(b)在服务定义中添加了一个behaviorConfiguration="mex":(

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

c)行为条目

<behaviors>
    <serviceBehaviors>
        <behaviour name="mex">
            <serviceDebug includeExceptionDetailInFaults="false"/>
            <serviceMetadata />
        </behavior>
     </serviceBehaviors>
 </behaviors>

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>
沐歌 2024-10-02 23:59:11

我希望以下链接可以为您提供帮助。

并尝试添加以下内容:

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

I hope the following link may provide you the help.

And also try adding the following :

<endpoint address="mex" binding="mexTcpBinding" contract="IMetadataExchange"/>
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文