17

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

干杯,丹妮。

4

3 回答 3

23

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

这就是短篇小说。如果您想了解更多详细信息,我在http://blogs.msdn.com/b/carlosfigueira/archive/2012/03/26/mixing-add-service-reference-and-wcf-上写了一篇关于它的博客文章web-http-aka-rest-endpoint-does-not-work.aspx

于 2011-09-20T02:59:55.270 回答
1

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

• 类型:Stream、Message、XmlElement、XmlAttribute、XmlNode,实现 IXmlSerializable 接口的类型,包括相关的 XmlSchemaProviderAttribute 属性,以及 XDocument 和 XElement 类型以及 ADO.NET DataTable 类型。

• 双工合同。

• 交易。

• 安全性:CardSpace、证书和用户名/密码。

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

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

于 2012-01-16T09:33:32.183 回答
-1

尝试添加公开元数据的“mexHttpBinding”端点

于 2011-09-20T06:04:57.500 回答