Duplex binding fails with netTcpBinding through NAT-translated router

I am having an issue using callbacks with netTcpBinding. We get this error when attemping a first connection to the server side from the client. This only happens for clients that are NAT-translated through a router. All other clients connect just fine.

-- Error Details --
System.ServiceModel.CommunicationObjectAbortedException: The communication object, System.ServiceModel.Channels.ClientReliableDuplexSessionChannel, cannot be used for communication because it has been Aborted.

Server stack trace:
at System.ServiceModel.AsyncResult.End[TAsyncResult](IAsyncResult result)
at System.ServiceModel.Channels.ServiceChannel.SendAsyncResult.End(SendAsyncResult result)
at System.ServiceModel.Channels.ServiceChannel.EndCall(String action, Object[] outs, IAsyncResult result)
at System.ServiceModel.Channels.ServiceChannelProxy.InvokeEndService(IMethodCallMessage methodCall, ProxyOperationRuntime operation)
at System.ServiceModel.Channels.ServiceChannelProxy.Invoke(IMessage message)

Exception rethrown at [0]:
at System.Runtime.Remoting.Proxies.RealProxy.HandleReturnMessage(IMessage reqMsg, IMessage retMsg)
at System.Runtime.Remoting.Proxies.RealProxy.PrivateInvoke(MessageData& msgData, Int32 type)
at IServer.EndLogin(IAsyncResult result)
at ServerClient.EndLogin(IAsyncResult result)
at GameStreet.GSTalk.frmMain.LoginStep2(IAsyncResult result)
Here is the configuration of my client's enpoint:

Dim oBindingAsNew NetTcpBinding(SecurityMode.None,True)

With oBinding

.Name ="DuplexBinding"

.OpenTimeout = TimeSpan.Parse("00:00:10")

.CloseTimeout = TimeSpan.Parse("00:00:05")

.ReceiveTimeout = TimeSpan.Parse("00:00:30")

.SendTimeout = TimeSpan.Parse("00:00:05")

.ListenBacklog = 50

.MaxConnections = 50

With .ReaderQuotas

.MaxDepth = 32

.MaxStringContentLength = 8192

.MaxArrayLength = 16384

.MaxBytesPerRead = 4096

.MaxNameTableCharCount = 16384

EndWith

With .ReliableSession

.Enabled =True

.Ordered =True

.InactivityTimeout = TimeSpan.Parse("00:01:30")

EndWith

EndWith

Dim oAddressAsNew EndpointAddress(m_sServerURL)

m_oServer =New ServerClient(New InstanceContext(oCallbackInstance), oBinding, oAddress)

I am also using port 80 to listen on my server. I dont know if that would have anything to do with it. Any ideas guys?

[5149 byte] By [JRodman] at [2008-1-8]
# 1

Putting Clients behind NAT will not work with Duplex Message Pattern since it will not support back channels for server to client communication. One option to make it work would be to use Teredo technology. For more information please refer http://blogs.msdn.com/drnick/archive/2006/05/01/configuring-wcf-for-nats-and-firewalls.aspx

Jandeepc at 2007-10-2 > top of Msdn Tech,Visual Studio Orcas,Windows Communication Foundation (Indigo)...
# 2

AFAIK, TCP transport should work with duplex even when your clients are behind NAT. Do you have a firewall that blocks the incoming traffic? Also would you mind sharing your service method code that callsback the client?

BuddhikedeSilva at 2007-10-2 > top of Msdn Tech,Visual Studio Orcas,Windows Communication Foundation (Indigo)...

Visual Studio Orcas

Site Classified