Click here to Skip to main content
14,935,153 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more: , +
I created a simple WCF service and hosted it in IIS by creating a new website. In Web.config file,I am providing bindings for http and net tcp. I created a console client and adding service reference. It generates two binding in client config - for http and for tcp. When I try to invoke the service using tcp, I get this error -

An unhandled exception of type 'System.ServiceModel.EndpointNotFoundException' occurred in mscorlib.dll Additional information: There was no endpoint listening at net.tcp://computername/Service.svc that could accept the message. This is often caused by an incorrect address or SOAP action.

when I run using Http endpoint(means I use Http endpoints in my client), it works fine.

My website Web.config file looks like

<system.serviceModel>
<bindings>
  <netTcpBinding>
    <binding name="NewBinding0" portSharingEnabled="true">
      <security mode="None"  />
    </binding>
  </netTcpBinding>
</bindings>
<services>
  <service behaviorConfiguration="My" name="WCFServiceOM.Service1"> <!--  the service name must match the configuration name for the service implementation. -->
    <endpoint address="" binding="basicHttpBinding" contract="WCFServiceOM.IService1"/>
    <endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange"/>
    <endpoint  binding="netTcpBinding" bindingConfiguration="NewBinding0" contract="WCFServiceOM.IService1" />
    <endpoint address="mexOM" binding="mexTcpBinding" contract="IMetadataExchange"/>
    <host>
      <baseAddresses>
        <add baseAddress="net.tcp://localhost:8087/Service1" />
        <add baseAddress="http://localhost:7777/Service1"/>
      </baseAddresses>
    </host>
  </service>
</services>
<behaviors>
  <endpointBehaviors>
    <behavior name="webBehanior">
      <webHttp/>
    </behavior>
  </endpointBehaviors>
  <serviceBehaviors>
    <behavior name="My">
      <!-- To avoid disclosing metadata information, set the values below to false before deployment -->
      <serviceMetadata httpGetEnabled="true" httpsGetEnabled="true"/>
      <!-- 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="true"/>
    </behavior>
  </serviceBehaviors>
</behaviors>


And my client App.Config look like

<configuration>
<startup> 
    <supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.6" />
</startup>
<system.serviceModel>
    <bindings>
        <basicHttpBinding>
            <binding name="BasicHttpBinding_IService1" />
        </basicHttpBinding>
        <netTcpBinding>
            <binding name="NetTcpBinding_IService1">
                <security mode="None" />
            </binding>
        </netTcpBinding>
    </bindings>
    <client>
        <endpoint address="http://computername:7777/Service.svc"
            binding="basicHttpBinding" bindingConfiguration="BasicHttpBinding_IService1"
            contract="ServiceReference1.IService1" name="BasicHttpBinding_IService1" />
        <endpoint address="net.tcp://computername/Service.svc" binding="netTcpBinding"
            bindingConfiguration="NetTcpBinding_IService1" contract="ServiceReference1.IService1"
            name="NetTcpBinding_IService1" />
    </client>
</system.serviceModel>


Please Help. Thank you so much in advance

What I have tried:

I am using Windows 10 OS, IIS 10.0 and WPAS\WAS (Windows Process Activation Service) are installed. I already enabled\checked HTTP Activation, TCP Activation in .Net framework in Windows features. And modified IIS server settings to include net tcp.
Posted
Updated 16-Jul-17 23:49pm
v3
Comments
Richard Deeming 14-Jul-17 13:10pm
   
If you're hosting in IIS, the port number in the config file is ignored. The client needs to connect using the port number configured in the IIS bindings for the site.
londhess 17-Jul-17 6:11am
   
in your client config, i do not see port number on tcp binding.
<endpoint address="net.tcp://computername:8087/Service.svc" binding="netTcpBinding"
bindingConfiguration="NetTcpBinding_IService1" contract="ServiceReference1.IService1"
name="NetTcpBinding_IService1" />

1 solution

Please refer below URL and let me know it works.


[NET TCP Configuaration]
   
v2

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)




CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900