我已成功为我的原型服务配置了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吗?
干杯, 达尼。
答案 0 :(得分:21)
这是因为Web端点(与SOAP端点不同)不会公开元数据,因此测试客户端在下载服务的WSDL时并不知道它。与SOAP(具有明确定义的公开元数据格式(WSDL,MEX))不同,Web(a.k.a. 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
写了一篇关于它的博客文章答案 1 :(得分:1)
以下是WCF测试客户端不支持的功能列表:
•类型:Stream,Message,XmlElement,XmlAttribute,XmlNode,实现 IXmlSerializableinterface,包括相关的XmlSchemaProviderAttribute属性,以及XDocument和XElement类型以及ADO.NET DataTable类型。
•双面合同。
•交易。
•安全性:CardSpace,证书和用户名/密码。
•绑定:WSFederationbinding,任何Context绑定和Https绑定,WebHttpbinding(Json响应消息支持)。
答案 2 :(得分:-1)
尝试添加公开元数据的“mexHttpBinding”端点