Constant "System.ServiceModel.EndpointNotFoundException: There was no endpoint listening at <Service URL>" errors

user2093327 picture user2093327 · Feb 21, 2013 · Viewed 8.4k times · Source

I have a number of WCF services, running on IIS on a dedicated server. These services have their clients. All in all it works, but whenever I look up the logs at the client-level, I usually see these kind of errors:

System.ServiceModel.EndpointNotFoundException: There was no endpoint listening at <Service URL> that could accept the message. This is often caused by an incorrect address or SOAP action. See InnerException, if present, for more details. 

---> System.Net.WebException: Unable to connect to the remote server 
---> System.Net.Sockets.SocketException: A socket operation was attempted to an unreachable network <Service IP>:80
   at System.Net.Sockets.Socket.DoConnect(EndPoint endPointSnapshot, SocketAddress socketAddress)
   at System.Net.ServicePoint.ConnectSocketInternal(Boolean connectFailure, Socket s4, Socket s6, Socket& socket, IPAddress& address, ConnectSocketState state, IAsyncResult asyncResult, Int32 timeout, Exception& exception)
   --- End of inner exception stack trace ---
   at System.Net.HttpWebRequest.GetRequestStream(TransportContext& context)
   at System.Net.HttpWebRequest.GetRequestStream()
   at System.ServiceModel.Channels.HttpOutput.WebRequestHttpOutput.GetOutputStream()
   --- End of inner exception stack trace ---

Server stack trace:
   at System.ServiceModel.Channels.HttpOutput.WebRequestHttpOutput.GetOutputStream()
   at System.ServiceModel.Channels.HttpOutput.Send(TimeSpan timeout)
   at System.ServiceModel.Channels.HttpChannelFactory.HttpRequestChannel.HttpChannelRequest.SendRequest(Message message, TimeSpan timeout)
   at System.ServiceModel.Channels.RequestChannel.Request(Message message, TimeSpan timeout)
   at System.ServiceModel.Dispatcher.RequestChannelBinder.Request(Message message, TimeSpan timeout)
   at System.ServiceModel.Channels.ServiceChannel.Call(String action, Boolean oneway, ProxyOperationRuntime operation, Object[] ins, Object[] outs, TimeSpan timeout)
   at System.ServiceModel.Channels.ServiceChannelProxy.InvokeService(IMethodCallMessage methodCall, ProxyOperationRuntime operation)
   at System.ServiceModel.Channels.ServiceChannelProxy.Invoke(IMessage message)

But right after that this same program would send requests that would work correctly.

This is the configuration of the WCF Service:

<netTcpBinding>
        <binding   name="config" closeTimeout="0:5:0" openTimeout="0:5:0" sendTimeout="0:5:0" receiveTimeout="0:5:0"
                 maxBufferPoolSize="8388608" maxBufferSize="8388608" maxReceivedMessageSize="8388608" maxConnections="8388608">
          <readerQuotas maxArrayLength="8388608" maxNameTableCharCount="8388608" maxStringContentLength="8388608"/>
          <security mode="None"/>
        </binding>
</netTcpBinding>

and

<basicHttpBinding>
        <binding  name="config2" closeTimeout="0:5:0" openTimeout="0:5:0" sendTimeout="0:5:0" receiveTimeout="0:5:0"
                 maxBufferPoolSize="838860800" maxBufferSize="838860800" maxReceivedMessageSize="838860800">
          <readerQuotas maxArrayLength="838860800" maxNameTableCharCount="838860800" maxStringContentLength="838860800"/>
          <security mode="None"/>
        </binding>
</basicHttpBinding>

Service behavior:

<behavior>
          <!-- To avoid disclosing metadata information, set the value below to false and remove the metadata endpoint above before deployment -->
          <serviceMetadata httpGetEnabled="false"/>
          <!-- 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"/>
          <dataContractSerializer maxItemsInObjectGraph="838860800"/>
</behavior>

I think there may be a limit somewhere for the number of simultaneous connections. Or maybe its something in IIS settings or something in the WCF service configuration. But I can't find what and where.

Also, the NetTcpBinding configuration has a property MaxConnection, but basicHttpBinding does not.

Thanks a lot in advance for your help!

Answer

Sujay picture Sujay · Oct 23, 2013

Following is the solved version of my own Web.config (Suitable for my project). Useful hints may be picked from the following working sample. -- Sujayyendhiren

  <service name="WelcomeSOAPXMLService">
    <endpoint address="http://localhost:16672/Service.svc" binding="basicHttpBinding"  contract="IWelcomeSOAPXMLService"/>