WCF REST服务在WCFTestClient中不可见

cod*_*dog 16 wcf wcftestclient webhttpbinding wcf-rest

我已经为我的原型服务成功配置了3个端点.端点是basicHttpBinding,wsHttpBinding和webHttpBinding.我目前唯一的故障是WCFTestClient.当我将它指向我的服务时,它会列出前两个,但不会列出webHttpBinding.我可以通过浏览器测试REST端点,它工作得很好.这是我的配置:

 <system.serviceModel>
    <services>
      <service behaviorConfiguration="serviceBehaviour" name="VMDServices.VMDService">
        <endpoint binding="webHttpBinding"
                  address="rest" behaviorConfiguration="webBehaviour" contract="VMDServices.IService1">
          <identity>
            <dns value="localhost"/>
          </identity>
        </endpoint>
        <endpoint binding="basicHttpBinding"
                  address="basic" bindingConfiguration="basicBinding" contract="VMDServices.IService1">
        </endpoint>
        <endpoint binding="wsHttpBinding"
                  address="ws" bindingConfiguration="wsBinding" contract="VMDServices.IService1">
          <identity>
            <dns value="localhost"/>
          </identity>
        </endpoint>
      </service>
    </services>

    <bindings>
      <basicHttpBinding>
        <binding name="basicBinding" maxBufferSize="2147483647" maxReceivedMessageSize="2147483647">
          <security mode="None"></security>
          <readerQuotas maxStringContentLength="2147483647"/>
        </binding>
      </basicHttpBinding>
      <wsHttpBinding>
        <binding name="wsBinding" transactionFlow="true">
          <security mode="None"></security>
          <reliableSession enabled="true" ordered="true" />
        </binding>
      </wsHttpBinding>
    </bindings>

    <behaviors>
      <endpointBehaviors>
        <behavior name="webBehaviour">
          <webHttp />
        </behavior>
      </endpointBehaviors>
      <serviceBehaviors>
        <behavior name="serviceBehaviour">
          <!-- To avoid disclosing metadata information, set the value below to false and remove the metadata endpoint above before deployment -->
          <serviceMetadata httpGetEnabled="true"/>
          <!-- 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 multipleSiteBindingsEnabled="true" aspNetCompatibilityEnabled="true">
    </serviceHostingEnvironment>
  </system.serviceModel>
Run Code Online (Sandbox Code Playgroud)

我有什么理由在WCFTestClient工具中看不到webHttpEndpoint吗?

干杯,丹妮.

car*_*ira 21

这是因为Web端点(与SOAP端点不同)不会公开元数据,因此测试客户端在下载服务的WSDL时并不知道它.与SOAP(具有明确定义的用于公开元数据的格式(WSDL,MEX))不同,Web(也称为REST)端点则不然.

这是短篇小说.如果你想了解更多细节,我在http://blogs.msdn.com/b/carlosfigueira/archive/2012/03/26/mixing-add-service-reference-and-wcf-上写了一篇关于它的博客文章.Web的http-AKA休息,端点不-不work.aspx