WCF REST服务在WCFTestClient中不可见



我已经成功地为原型服务配置了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>

是否有任何原因,我不能看到在WCFTestClient工具的webHttpEndpoint ?

欢呼,丹妮。

这是因为web端点(不像SOAP端点)不公开元数据,所以测试客户端在为服务下载WSDL时并不知道元数据。与SOAP不同,SOAP有明确定义的格式来公开元数据(WSDL、MEX), web(又名REST)端点没有。

这是一个简短的故事。如果您想了解更多细节,我在http://blogs.msdn.com/b/carlosfigueira/archive/2012/03/26/mixing-add-service-reference-and-wcf-web-http-a-k-a-rest-endpoint-does-not-work.aspx

上写了一篇关于它的博客文章。

以下是WCF测试客户端不支持的特性列表:

•类型:流,消息,XmlElement, xmllattribute, XmlNode,实现IXmlSerializableinterface,包括相关的XmlSchemaProviderAttribute属性、XDocument和XElement类型以及ADO。. NET数据表类型。

•双工合同。

•事务。

•安全:CardSpace, Certificate, and Username/Password.

•绑定:WSFederationbinding,任何上下文绑定和Https绑定,WebHttpbinding (Json响应消息支持)。

来源:http://msdn.microsoft.com/en-us/library/bb552364.aspx

尝试添加"mexHttpBinding"端点来公开元数据

相关内容

  • 没有找到相关文章

最新更新