Problems with WCF Duplex net.tcp on win7

We have a WCF service with several clients for planning operations between clients. He did an excellent job with XP. Going to win7, I can only connect the client to a server on one computer. At the moment, I think this is due to IPv6, but I'm at a dead end on how to proceed.

A client trying to connect to a remote server gives the following exception:

System.ServiceModel.EndpointNotFoundException: Failed to connect to net.tcp: //10.7.11.14: 18297 / zetec / Service / SchedulerService / Scheduler. The connection attempt continued for a period of 00: 00: 21.0042014. Error code 10060 TCP: The connection attempt failed because the connected party did not respond properly after a certain period of time or failed to establish a connection because the connected host was unable to respond 10.7.11.14:18297. ---> System.Net.Sockets.SocketException: the connection attempt failed because the connected party did not respond properly after some time or the connection failed because the connected host could not respond 10.7.11.14:18297

The service is configured as follows:

<system.serviceModel> <services> <service name="SchedulerService" behaviorConfiguration="SchedulerServiceBehavior"> <host> <baseAddresses> <add baseAddress="net.tcp://localhost/zetec/Service/SchedulerService"/> </baseAddresses> </host> <endpoint address="net.tcp://localhost:18297/zetec/Service/SchedulerService/Scheduler" binding="netTcpBinding" bindingConfiguration = "ConfigBindingNetTcp" contract="IScheduler" /> <endpoint address="net.tcp://localhost:18297/zetec/Service/SchedulerService/Scheduler" binding="netTcpBinding" bindingConfiguration = "ConfigBindingNetTcp" contract="IProcessingNodeControl" /> </service> </services> <bindings> <netTcpBinding> <binding name = "ConfigBindingNetTcp" portSharingEnabled="True"> <security mode="None"/> </binding> </netTcpBinding > </bindings> <behaviors> <serviceBehaviors> <behavior name="SchedulerServiceBehavior"> <serviceDebug includeExceptionDetailInFaults="true" /> <serviceThrottling maxConcurrentSessions="100"/> </behavior> </serviceBehaviors> </behaviors> </system.serviceModel> 

The client connects like this:

 String endPoint = "net.tcp://" + GetIPV4Address(m_SchedulerHostAddress) + ":" + m_SchedulerHostPort.ToString(CultureInfo.InvariantCulture) + "/zetec/Service/SchedulerService/Scheduler"; NetTcpBinding binding = new NetTcpBinding(); binding.Security.Mode = SecurityMode.None; m_Channel = new DuplexChannelFactory<IProcessingNodeControl>(this, binding, endPoint); m_IProcessingNodeControl = m_Channel.CreateChannel(); 

I checked my firewall about a dozen times, but I think there might be something that I don’t see. Tried to disable the windows firewall. I tried changing localhost to my ipv4 address to try to stay away from ipv6, I tried to remove any anti-ipv6 code.

I don’t know what this means, but:

Microsoft Telnet> open 10.7.11.14 18297
Connecting to 10.7.11.14 ... Could not open connection with host, on port 18297: Could not connect

The telnet test, unfortunately, is not the key. I successfully connected to my service port from the local host and the remote computer when the service is running, but my client did not work from the remote computer.

It seems that connecting to localhost is not always guaranteed. The desktop (win7 / 32) is working, the laptop (win7 / 64) is not working. However, other win7 / 64 boxes work. Perhaps due to repeated reception on a laptop? Also does not explain connection failures to tester systems.

I installed two win7 machines with IPv6 completely disabled (using 0xffffffff, as in http://support.microsoft.com/kb/929852 ). No help.

+4
source share
2 answers

I don’t have time to go back and check if this is a combination of help received from ligos or not, but the main fix seems to add SMSvcHost.exe to the exceptions from the Windows firewall.

Thanks so much for your help, league. I was ready to refuse until you answered my question.

Instructions for adding net.tcp to the Windows Firewall:

  • Go to the Services section, find the net.TCP port sharing service and double-click on it. Navigate to the executable file (don’t worry if it’s not all on the screen, the scroll action should scroll it) and copy it (ctrl-c)
  • Go to the firewall and add a new program that will be allowed to communicate through the Windows firewall. Paste the path from the Service and click OK.
+2
source

Something doesn't look like your base host address, and then your endpoint addresses. One has an explicit link to the port, and the other does not. Usually, when you use the base address, you use the relative URL in the endpoint address.

I cannot understand why this would be due to IPv6, because none of the error messages mention IPv6 addresses.

Perhaps try again after disabling the net.tcp port sharing option. Without port sharing, you should be able to connect using telnet, just like you do.

Also, how is your service hosted in Win7? In IIS7 or self hosted in a windows service? To place it in a service, it may be necessary to provide some permissions for your exe outside of opening ports on your firewall (for example, you sometimes have to do an HTTP service for Windows in Win XP).

Sorry, I'm in a hurry and can't find the urls for them.

+2
source

Source: https://habr.com/ru/post/1303963/


All Articles