2012-03-19 16 views
9

Estoy intentando ejecutar un simple servicio WCF ..."No había punto final a escuchar ..."

Mi servicio WCF .config:

<system.serviceModel> 
<services> 
    <service name ="WebService.Receptor"> 
    <endpoint 
     address = "http://MyServer:8000/WS" 
     binding = "wsHttpBinding" 
     contract = "IMyContract" 
    /> 
    </service> 
</services> 
<behaviors> 
    <serviceBehaviors> 
    <behavior> 
     <serviceDebug includeExceptionDetailInFaults="false"/> 
    </behavior> 
    </serviceBehaviors> 
</behaviors> 
<serviceHostingEnvironment multipleSiteBindingsEnabled="true" /> 

Mi servicio de Windows .config:

<system.serviceModel> 
<client> 
    <endpoint 
    name = "Receptor" 
    address = "http://MyServer:8000/WS" 
    binding = "wsHttpBinding" 
    contract = "IMyContract" 
    /> 
</client> 
</system.serviceModel> 

Obs: La Serv WCF el hielo se está ejecutando bajo IIS 7.5 en Windows 7.

Así, cuando trato de llamar a un método desde el proxy WCF (IMyContract) Tengo este error:

There was no endpoint listening at http://MyServer:8000/WS that could accept the message. This is often caused by an incorrect address or SOAP action. See InnerException, if present, for more details.

La excepción interna:

{"Unable to connect to the remote server"}

¿Alguien sabe por qué?

Respuesta

11

Cuando aloja un servicio WCF en IIS, no especifica una url absoluta en la dirección. Debe usar una url relativa al archivo .svc. La url base será determinada por el sitio web donde está alojada.

<service name="WebService.Receptor"> 
    <endpoint 
     address="/WS.svc" 
     binding="wsHttpBinding" 
     contract="IMyContract" 
    /> 
</service> 

y en el cliente, en función de cómo esté configurado el IIS que, obviamente, debe especificar la dirección completa:

<client> 
    <endpoint 
     name="Receptor" 
     address="http://MyServer:8000/WS.svc" 
     binding="wsHttpBinding" 
     contract="IMyContract" 
    /> 
</client> 

Esto supone que se ha configurado un sitio en IIS que escucha en el puerto 8000 y que ha alojado su aplicación WCF dentro de este sitio.

Cuestiones relacionadas