【问题标题】:Why IMetadataExchange is invisible?为什么 IMetadataExchange 是不可见的?
【发布时间】:2011-09-29 09:44:23
【问题描述】:

我创建了使用 IIS 6 (Windows XP) 托管的 WCF 服务:

<system.serviceModel>        
    <behaviors>
      <serviceBehaviors>
        <behavior name="myServiceBehaviors">          
          <serviceMetadata httpGetEnabled="true"/>          
          <serviceDebug includeExceptionDetailInFaults="false"/>
        </behavior>
      </serviceBehaviors>
    </behaviors>    
    <services>
      <service name="Namespace.Class" behaviorConfiguration="myServiceBehaviors">                
        <endpoint  contract="IMetadataExchange" binding="mexHttpBinding" address="mex" />        
      </service>      
    </services>        
    <serviceHostingEnvironment multipleSiteBindingsEnabled="true" />
  </system.serviceModel>      

我已经使用 Visual Studio 2010 创建了虚拟目录 (MyVirtualFolder),当我将浏览器指向“http://localhost/MyVirtualFolder/MyService.svc”时 我收到错误页面,告诉我我应该打开 metadataExchange 接口,并说明如何执行此操作,我将如何修改我的配置文件。我仔细检查了一下,我的配置等于 html 页面提出的配置。

为什么IMetaDataExchange接口不可用?

提前谢谢你!

【问题讨论】:

  • 您使用的是什么类型的绑定。请添加完整的配置代码
  • 我认为您的问题是您没有为服务配置“主要”端点。您只配置了 mex 端点。

标签: .net wcf web-services configuration wcf-configuration


【解决方案1】:

尝试&lt;serviceMetadata /&gt; 而不是&lt;serviceMetadata httpGetEnabled="true"/&gt;
如果您在 IIS 中托管 Web 服务,则您有一个 *.svc 文件。您不需要端点来获取元数据、删除端点,一切都会正常工作..

【讨论】:

    【解决方案2】:

    从您的 IMetadataExchange 端点中删除 address="mex"

    您的服务本身也没有实际的端点。

    如果可能,请尝试使用 WCF 配置编辑器(Windows SDK 的一部分)SvcConfigEditor 来获取有效的服务和客户端配置。

    【讨论】:

      【解决方案3】:

      终于知道是什么原因了:

      &lt;service name="Namespace.Class"&gt; 指向错误的类:(

      【讨论】:

        猜你喜欢
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 2011-07-08
        • 2016-08-13
        • 1970-01-01
        • 2015-10-02
        • 1970-01-01
        相关资源
        最近更新 更多