none
Endpoint now found exception when try to consume WebSocket wcf Services RRS feed

  • Question

  • I am having WCF custom binding web socket Service. Below are service configurations settings.

    <system.serviceModel>
        <bindings>
          <customBinding>
            <binding name="CustomWsBinding" receiveTimeout="03:00:00">
              <byteStreamMessageEncoding/>
              <httpTransport>
                <webSocketSettings transportUsage="Always" createNotificationOnConnection="true" keepAliveInterval="03:00:00"/>
              </httpTransport>
            </binding>
          </customBinding>
        </bindings>
        <services>
          <service name="WCF_WebSocket.TestService" behaviorConfiguration="ServiceBehavior">
            <endpoint address="" binding="customBinding" bindingConfiguration="CustomWsBinding" contract="WCF_WebSocket.ITestService"/>
            <host>
              <baseAddresses>
                <add baseAddress="http://localhost:13060/"/>
              </baseAddresses>
            </host>
            <endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange" />
          </service>
        </services>
        <behaviors>
          <serviceBehaviors>
            <behavior name="ServiceBehavior">
              <serviceDebug includeExceptionDetailInFaults="false" />
              <!-- Set to true for debugging-->
              <serviceMetadata httpGetEnabled="true"/>
            </behavior>
          </serviceBehaviors>
        </behaviors>
      </system.serviceModel>

    When i am trying consume my service in my console application I am getting exception as EndpointNotFoundException: There was no endpoint listening at ws://localhost:13060/ that could accept the message.

    I generated a scaffolding of my wcf service by Adding serviceReference. Below is my Csharp Code.

    var client = new ServiceReference1.TestServiceClient(); var x = client.GetDataAsync("Hello"); x.Wait(); var result = x.Result;

     


    I got struck on this for 2 days. I am using visual studio 2017.

    Thursday, January 24, 2019 5:53 AM

All replies

  • Hi Gopi247,

    Are the server and client the same machines? Please modify the auto-generated endpoint address according to the actual situation.(located in the auto-generated Reference.cs file)

    private static System.ServiceModel.EndpointAddress GetEndpointAddress(EndpointConfiguration endpointConfiguration)
    {
    if ((endpointConfiguration == EndpointConfiguration.NetHttpBinding_IStockQuoteService))
    {
    return new System.ServiceModel.EndpointAddress("ws://10.157.13.69:13060/");
    }

    IP address should be server actual IP address. 
    Feel free to let me know if the problem still exists.
    Best Regards
    Abraham

    Monday, January 28, 2019 3:14 AM
    Moderator
  • Still getting same error.
    Monday, January 28, 2019 7:00 AM
  • How do you ensure the server service is hosting and works correctly? could you generate the client proxy class successfully according to the service metadata address?
    Monday, January 28, 2019 8:26 AM
    Moderator
  • I have hosted the service on console application. Yes i was able to generate proxy as meta data. If you want to look at the application here it is https://github.com/gopi247/WCF_WebSocket  
    Tuesday, January 29, 2019 5:35 AM
  • Hi gopi247,
    I downloaded your project and found that there is no callbackcontract in your service contract. So what's the point of using websocket here? in my opinion, there is no need to use nethttpbinding at here. in order to test your service, I choose to use basichttpbinding and modify the service endpoint. It works.

    Best Regards

    Abraham

    Wednesday, January 30, 2019 6:09 AM
    Moderator