IMetadataExchange WCF配置错误

时间:2011-10-19 20:34:40

标签: c# vb.net wcf

我在WCF服务中收到以下错误消息。下面是我的网站,配置。我尝试了一些事情,没有解决错误。任何帮助表示赞赏。

  

客户端配置中的合同“IMetadataExchange”没有   匹配服务合同中的名称

<?xml version="1.0"?>
<configuration>
 <connectionStrings/>
   <system.web>
     <compilation strict="false" explicit="true" targetFramework="4.0" debug="true"/>
   </system.web>
<system.serviceModel>
<behaviors>
  <serviceBehaviors>
    <behavior name="">
      <serviceMetadata httpGetEnabled="true"/>
      <serviceDebug includeExceptionDetailInFaults="false"/>
    </behavior>
  </serviceBehaviors>
</behaviors>
<bindings>
  <basicHttpBinding>
    <binding name="SNCBinding" closeTimeout="00:10:00" openTimeout="00:10:00"
      receiveTimeout="00:10:00" sendTimeout="00:10:00" maxBufferSize="2147483647"
      maxReceivedMessageSize="2147483647" textEncoding="utf-8">
      <readerQuotas maxDepth="2147483647" maxStringContentLength="2147483647"
        maxArrayLength="2147483647" maxBytesPerRead="2147483647" maxNameTableCharCount="2147483647" />
      <security mode="TransportCredentialOnly">
        <transport clientCredentialType="Windows" proxyCredentialType="Windows" />
      </security>
    </binding>
  </basicHttpBinding>
</bindings>
<serviceHostingEnvironment aspNetCompatibilityEnabled="true"
  multipleSiteBindingsEnabled="true" />
<services>
  <service name="SNC.MaterialRequest.WCF.MaterialRequest">
    <endpoint address="" binding="basicHttpBinding" bindingConfiguration="SNCBinding"
      contract="SNC.MaterialRequest.WCF.MaterialRequest" />
  </service>
</services>
 </system.serviceModel>
 </configuration>

2 个答案:

答案 0 :(得分:3)

您是否有机会安装.Net Services SDK?

请参阅:http://azure.snagy.name/blog/?tag=imetadataexchange

听起来它在您的machine.config中为IMetaDataExchange添加了一个客户端端点。因此,您可以从machine.config中删除它,也可以添加

<client>
  <remove contract=”IMetadataExchange” name=”sb” />
</client>
从现在开始

到每个app.config / web.config。

编辑:请注意,这不应该影响您的实际应用,这只是一个警告,您可以忽略。这里也提到了:http://blogs.msdn.com/b/wcftoolsteamblog/archive/2008/08/28/tips-for-wcf-tools-in-vs2008-sp1.aspx

答案 1 :(得分:0)

问题在于:

contract="SNC.MaterialRequest.WCF.MaterialRequest"

它与错误的IMetadataExchange不同。所以它在服务器端配置或客户端配置中都是错误的。我想在服务器端说,因为这应该是接口。