2011-09-20 17 views
15

He configurado con éxito 3 puntos finales para mi prototipo de servicio. Los puntos finales son basicHttpBinding, wsHttpBinding y webHttpBinding. El único problema que tengo en este momento es en WCFTestClient. Cuando lo señalo a mi servicio, enumera los dos primeros, pero no el enlace webHttpBinding. Puedo probar el punto final REST a través de mi navegador y funciona muy bien. noWCF REST Servicio no visible en WCFTestClient

<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> 

hay ninguna razón por qué no puedo ver el webHttpEndpoint en la herramienta WcfTestClient: Aquí está mi configuración?

Cheers, Dany.

+1

cliente de prueba WCF es para ** ** SOAP de servicios basados ​​en nada - ** ** PERO 'webHttpBinding' .... –

Respuesta

20

Es porque los puntos finales web (a diferencia de los SOAP) no exponen los metadatos, por lo que el cliente de prueba no lo sabe cuando descarga el WSDL para el servicio. A diferencia de SOAP, que tiene formatos bien definidos para exponer metadatos (WSDL, MEX), los puntos finales web (a.k.a. REST) ​​no.

Esa es la historia corta. Si desea conocer más detalles, escribí un post sobre ello en 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

+0

Esa es mi idea inicial ... entonces me encontré con este http: //knowledgebaseworld.blogspot.com/2010/06/wcf-service-with-webhttpbinding.html - este tipo de gente lo consiguió de alguna manera en su WCFTestClient – codedog

+0

Ese punto final en realidad no se puede usar para llamar con JSON (o XML simple) : no tiene el comportamiento '' en él. Y también probé exactamente el mismo escenario que él, y cuando navegué a la página WSDL, solo pude ver dos elementos '' (uno para básicos, uno para ws), ninguno para el punto final 'webHttpBinding'. – carlosfigueira

+0

Sí, no tenía el comportamiento webHttp, que es algo que tengo en el mío ya que lo necesito para interactuar con jQuery.Ajax() llamadas. – codedog

-1

intento de añadir el punto final "mexHttpBinding" que expone los metadatos

+0

Eso no funcionará: los puntos finales webHttpBinding no están expuestos en los metadatos del servicio. – carlosfigueira

1

La siguiente es una lista de características no compatibles con WCF cliente de prueba:

• tipos: Stream, Mensaje, XmlElement, XmlAttribute, XmlNode, tipos que implementan la IXmlSerializableinterface, incluyendo el atributo relacionado XmlSchemaProviderAttribute, y los tipos XDocument y XElement y el tipo DataTable ADO.NET.

• Contrato a dos caras.

• Transacción.

• Seguridad: CardSpace, certificado y nombre de usuario/contraseña.

• Enlaces: WSFederationbinding, cualquier enlace de contexto y enlace Https, WebHttpbinding (soporte de mensaje de respuesta Json).

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

Cuestiones relacionadas