Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

WCF - "There was no endpoint listening at..." error

Tags:

wcf

I have two applications that I want to test locally on the same machine. App 1 has a simple WCF service with the folloiwng config entry:

<service behaviorConfiguration="MyNamespace.ContainerManagementServiceBehavior"
        name="MyNamespace.ContainerManagementService">
  <endpoint address="ContainerManagementService" binding="basicHttpBinding"
     name="ContainerManagementbasicHttpEndpoint"
     contract="MyNamespace.IContainer" />
  <endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange" />
  <host>
    <baseAddresses>
      <add baseAddress="http://localhost:8000/ContainerManagementService" />
    </baseAddresses>
  </host>
</service>    
<behaviors>      
  <behavior name="MyNamespace.ContainerManagementServiceBehavior">
    <serviceMetadata httpGetEnabled="true" />
    <serviceDebug includeExceptionDetailInFaults="false" />
  </behavior>
</behaviors>

I start the service by running the web application project where it is hosted. I am able to successfully browse to the url and get web service information page from ie. I copy the same URL and use it for my client.

My other client, App 2, has the following in its config file:

<system.serviceModel>
  <bindings>
    <basicHttpBinding>
      <binding name="basicHttp" closeTimeout="00:10:00"
        openTimeout="00:10:00" receiveTimeout="00:10:00"
        sendTimeout="00:10:00" allowCookies="false"
        bypassProxyOnLocal="false"
        hostNameComparisonMode="StrongWildcard"
        maxBufferSize="5242880" maxBufferPoolSize="524288"
        maxReceivedMessageSize="5242880" messageEncoding="Text"
        textEncoding="utf-8" transferMode="Buffered"
        useDefaultWebProxy="true">
      <readerQuotas maxDepth="32" maxStringContentLength="8192"
          maxArrayLength="16384"
          maxBytesPerRead="4096" maxNameTableCharCount="5242880" />
        <security mode="None">
          <transport clientCredentialType="None"
            proxyCredentialType="None" realm="" />
          <message clientCredentialType="UserName" algorithmSuite="Default" />
        </security>
      </binding>
    </basicHttpBinding>
  </bindings>
  <client>
    <endpoint
      address="http://localhost:3227/Services/ContainerManagementService.svc"
      binding="basicHttpBinding" bindingConfiguration="basicHttp"
      contract="MyService.IService" name="externalService" />      
  </client>
</system.serviceModel>

However, when I try to execute a WCF call form client to the running service, I get the following error message:

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

What could be happening?

like image 404
laconicdev Avatar asked Mar 28 '11 18:03

laconicdev


3 Answers

It looks likes the issue is due to the fact that both server and client are being run from the Cassini server. I am changing the architecture to host the server endpoint in IIS.

like image 134
laconicdev Avatar answered Oct 25 '22 18:10

laconicdev


Do you have two applications ?

One which hosts the server endpoint and the other which is the client ? Are both active in IIS (considering the second application is a web app) ?

If you have two projects for those two components in your solution, you can configure VS to start both project at the same time. This way you can put breakpoints on both the client and the server and see if the server really gets called by the client or if the exception happens without the server method being called.

like image 24
Gilles Avatar answered Oct 25 '22 18:10

Gilles


If your web service is on: http://localhost:8000/ContainerManagementService.svc

Your client app2 should point on this same addres:

<client>
      <endpoint address="http://localhost:8000/ContainerManagementService.svc"
        binding="basicHttpBinding" bindingConfiguration="basicHttp"
        contract="MyService.IService" name="externalService" />      
</client>
like image 36
Siekiera Avatar answered Oct 25 '22 20:10

Siekiera