2012-03-19 17 views
9

Próbuję uruchomić prosty usługi WCF ..."Nie było żadnego punktu końcowego na słuchanie ..."

Moje usługi 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" /> 

My usługi Windows .config:

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

Obs: WCF Serv Lód jest uruchomiona pod IIS 7.5 w systemie Windows 7.

Tak więc, gdy próbuję wywołać metodę z prokurentem wcf (IMyContract) mam ten błąd:

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.

Wewnętrzny wyjątek:

{"Unable to connect to the remote server"}

Ktoś wie dlaczego?

Odpowiedz

11

Podczas hostowania usługi WCF w IIS nie określa się bezwzględnego adresu URL w adresie. Powinieneś użyć względnego adresu URL do pliku .svc. Podstawowy adres URL zostanie określony przez witrynę internetową, na której jest hostowany.

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

i na kliencie, w zależności od tego, jak IIS jest skonfigurowany należy oczywiście podać pełny adres:

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

ta zakłada, że ​​po skonfigurowaniu witryny w IIS, który nasłuchuje na porcie 8000 i że hostowałeś swoją aplikację WCF na tej stronie.

Powiązane problemy