无法使MEX与我的WCF服务一起使用

时间:2013-06-07 09:58:24

标签: wcf mex

我认为这可能是因为没有/要求在配置中指定任何基地址。其他一切工作正常,包括发布WSDL,调用服务等,但是当我添加MEX端点并尝试访问它时,它返回503服务不可用。

我的web.config看起来像这样:

<system.serviceModel>
  <bindings>
    <basicHttpsBinding>
      <binding name="ServiceBinding" />
    </basicHttpsBinding>
  </bindings>
  <services>
    <service name="MyServices.CatService" behaviorConfiguration="MyBehavior">
      <endpoint address="" binding="basicHttpsBinding" bindingConfiguration="ServiceBinding" contract="MyServices.ICatService"></endpoint>
      <endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange" />
    </service>
  </services>
  <behaviors>
    <serviceBehaviors>
      <behavior name="MyBehavior">
        <!-- To avoid disclosing metadata information, set the values below to false before deployment -->
        <serviceMetadata httpGetEnabled="false" httpsGetEnabled="false" />
        <!-- To receive exception details in faults for debugging purposes, set the value below to true.  Set to false before deployment to avoid disclosing exception information -->
        <serviceDebug includeExceptionDetailInFaults="false" />
      </behavior>
    </serviceBehaviors>
  </behaviors>
  <serviceHostingEnvironment aspNetCompatibilityEnabled="true" multipleSiteBindingsEnabled="true" />
</system.serviceModel>

当我浏览我的服务时,收到消息:

  

您已创建了一项服务。        要测试此服务,您需要创建一个客户端并使用它来调用该服务。您可以使用svcutil.exe工具执行此操作   命令行使用以下语法:        svcutil.exe http:// [mypc] /MyServices/CatService.svc/mex

我有理由相信它与定义端点的方式有关,但我不知道如何解决它。有什么想法吗?

1 个答案:

答案 0 :(得分:2)

已解决 - 我复制并粘贴的上面的mex示例是http,而不是https。我把它改成了mexHttpsBinding并且效果很好。我认为http由于在本地运行http的一些配置而无效,但我不确定。

相关问题