Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

IIS8 There was no endpoint listening at net.tcp:

i have a WCF service host in IIS8 and I want to use a net.tcp binding.

I have this configuration:

Web.config:

<service behaviorConfiguration="MyBehavior"
  name="DecryptService.EmailCenterDecryptTCP">
    <host>
      <baseAddresses>
        <add baseAddress="net.tcp://XX.XX.XX.XX:808/VirtualFolder/Service.svc" />
      </baseAddresses>
    </host>

    <endpoint address=""
          binding="netTcpBinding"
          bindingConfiguration="portSharingBinding"
          name="MyServiceEndpoint"
          contract="ServiceNamespace.IService">
    </endpoint>

    <endpoint address="mextcp"
          binding="mexHttpBinding"
          bindingConfiguration=""
          name="MyServiceMexTcpBidingEndpoint"
          contract="IMetadataExchange" />
</service>

When I try to consume the service in the same machine as IIS8 with the following configuration works fine:

<client>
        <endpoint address="net.tcp://YY.YY.YY.YY:808/VirtualFolder/Service.svc"
            binding="netTcpBinding" bindingConfiguration="MyServiceEndpoint"
            contract="ServiceReference1.IService" name="MyServiceEndpoint" />
    </client>

YY.YY.YY.YY is the local IP of machine but when I try to consume the service in another machine changing YY.YY.YY.YY to external IP of the machine (ZZ.ZZ.ZZ.ZZ) that runs IIS8 I get the following error:

There was no endpoint listening at net.tcp://ZZ.ZZ.ZZ.ZZ/VirtualFolder/Service.svc that could accept the message. This is often caused by an incorrect address or SOAP action. See InnerException, if present, for more details.

Any Ideas? Thanks and sorry for my bad English

EDIT:

I made a console application running a ServiceHost replacing IIS and with this configuration it works over internet

var svh = new ServiceHost(typeof (Service));
svh.AddServiceEndpoint(typeof (ServiceNamespace.IService), new NetTcpBinding(SecurityMode.None), "net.tcp://serverLocalIp:808");
svh.Open();

Console.WriteLine("SERVER - Running...");
stopFlag.WaitOne();

Console.WriteLine("SERVER - Shutting down...");
svh.Close();

Console.WriteLine("SERVER - Shut down!");

Any idea whats wrong with IIS running the same service over internet? locally works. Thanks

like image 933
Sergio Figueiredo Avatar asked Apr 05 '13 16:04

Sergio Figueiredo


2 Answers

You also need to setup IIS to receive a Net.TCP connection.

Under Advanced Settings of your IIS Application, then under Enabled Protocols make sure you have http,net.tcp note that there is no space, if you have a space it will fail.

http://blogs.msdn.com/b/swiss_dpe_team/archive/2008/02/08/iis-7-support-for-non-http-protocols.aspx

like image 188
Middas Avatar answered Nov 17 '22 09:11

Middas


If you started receiving this error out of the blue one day, it is related to another process hijacking the net.tcp port. In my case it was port 808. Here is how I figured it out after about 3 days--ya this is what I do nowadays, Google and try to figure out other people's fups instead of doing my own work.

Anyhow:


  1. Net.TCP depends on 2 windows services to be running. Go to services and find Net.Tcp Listener Adapter and Net.Tcp Port Sharing Service. If you do not see them, then this answer does not apply to you. It means you have not activated the feature in control panel Turn Windows feature on or off. You will find plenty info on what to enable online.
  2. Stop the the Net.Tcp Port Sharing Service and click Yes in the Stop Other Services popup.
  3. Restart both services.
  4. Open Event Viewer > Windows Logs > System and see if you see any error for SMSvcHost 4.0.0.0 (your version may differ) in the Source column. I had this error: An error occurred in the Activation Service 'NetTcpActivator' of the protocol 'net.tcp' while trying to listen for the site '1', thus the protocol is disabled for the site temporarily. Yes, thanks MS! You started a service but did not really start it and simply added a message to the Event Viewer? Great! Because telling me during the windows service start is too hard, correct? Ok again, anyways, let's keep going.
  5. Then I needed to figure out what is using the port as per error in 4 above. So I ran the following commands (You may need to start the command prompt in admin mode.)
    • Run netstat -ano | findstr "808" and note the numbers in the column. Those are process IDs using the port.
    • Run tasklist | 9, where 9 would be the process ID from above step.
  6. Now that you know the process name that is using the port, you need to Google and find out what the process is for. In my case it was a related to Intel graphics driver using port 808: OneApp.IGCC.WinService.exe.

That makes sense because some other process was already using port 808 so it wasn't available for Net.TCP.


I had 2 options at this point:

  1. Disable that process
  2. Perhaps see if I can change the port for it.

Luckily they have an update for the driver already so I simply downloaded it and installed it from here.


Reboot then ran the following commands again to ensure the port is free for net.tcp:

  1. Run netstat -ano | findstr "808" and note the numbers in the column. Those are process IDs using the port.
  2. Run tasklist | 9, where 9 would be the process ID from above step. Now you should see SMSvcHost.exe which is what we want.

like image 36
CodingYoshi Avatar answered Nov 17 '22 09:11

CodingYoshi