Note that there are some explanatory texts on larger screens.

plurals
  1. POSelf-hosted WCF TCP connection error
    primarykey
    data
    text
    <p>I am new to WCF and stuck on a NET.TCP connection problem. </p> <p>Here's the setup. </p> <p>Server: Windows 8 Pro.</p> <p>Self-hosted WCF Service, using NetTcpBinding with SecurityMode.None:</p> <pre><code>try { _serviceHost = new ServiceHost(typeof(MouseTest)); _serviceHost.AddServiceEndpoint(typeof(IMouseTest), new NetTcpBinding(SecurityMode.None), "net.tcp://localhost:" + MyNetwork.Default.Port.ToString() + "/MyWPFServiceHost"); _serviceHost.CloseTimeout = new TimeSpan(0,0,5); _serviceHost.Open(); AddMessage("net.tcp open"); } catch (CommunicationException ce) { // MUST open visual studio as administrator!!!!! (Not this app, but actual VS2010. Console.WriteLine("An exception occurred: {0}", ce.Message); _serviceHost.Abort(); AddMessage(ce.Message); } catch (Exception ex) { AddMessage(ex.Message); } </code></pre> <p>Client machine (various types):</p> <pre><code>private void openTCPServiceButton_Click(object sender, RoutedEventArgs e) { String endpointAddress = "net.tcp://XX.XXX.XX.XX:" + MyNetwork.Default.Port.ToString() + "/MyWPFServiceHost"; if (channelFactory == null) channelFactory = new ChannelFactory&lt;IMouseTest&gt;(new NetTcpBinding(SecurityMode.None), new EndpointAddress(endpointAddress)); SendToListBox(channelFactory.Endpoint.Address.ToString()); try { proxy = channelFactory.CreateChannel(); proxy.StartRecording(); } catch (Exception ex) { AddMessageThreadSafe(ex.GetType().ToString() + ": " + ex.Message); } } </code></pre> <p>The service is hosted on my home machine, a Windows 8 box. When I connect from the same machine, all is well. From a different machine on the same LAN, all is well. From outside the LAN (on my office machine), I get:</p> <blockquote> <p>System.ServiceModel.EndpointNotFoundException: Could not connect to net.tcp://xx.xxx.xx.xx:8085/MyWPFServiceHost. The connection attempt lasted for a time span of 00:00:01.1241124. TCP error code 10061: No connection could be made because the target machine actively refused it.</p> </blockquote> <p>Same error if I completely disable the Win8 firewall. </p> <p>If I run a copy of the service on a Windows Server 2008 machine at home, I can connect fine from anywhere, including over the internet.</p> <p>Please, after 3 days of this I am getting nowhere. Please also remember that this is SELF-HOSTED and not IIS hosted. Many thanks for any insight or where to start looking. I have made sure that all the services that are normally mentioned with this 10061 error are turned on.</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload