Hippias Minor
Hippias Minor

Reputation: 1967

How to Access WCF Service Behind NAT

Here is my situation :

What may cause this ?

My Network Topology: Picture Link

enter image description here

Upvotes: 1

Views: 1428

Answers (2)

dvasanth
dvasanth

Reputation: 1377

Check with URI "net.tcp://0.0.0.0:8000", this will ensure that the service will accept connection from any inbound IP address. At server side, the IP address mentioned in the URI & address from which the connection is accepted differs so the server is dropping the connection.

Upvotes: 1

rodolk
rodolk

Reputation: 5907

I'm not experienced with WCF and nettcpbinding but this could help.

Theoretically it is not possible because your service has a local IP address, corresponding to the LAN where it is attached, and not a public IP address. So it could not be reached from the Internet, outside the NAT. However, almost all NAT devices, maybe your router/Access Point, have a feature for "Port Forwarding". This feature allows you to define that all packets addressed to a specific port are forwarded to a specific machine within you LAN, with a private IP address.

This could be a solution for you if you can overcome two hinders:

1-I don't know how the node in the Internet will send a message to the callback server. If it uses the IP address from which it received the request, there is not problem. If it receives a callback-IP address, then you have to figure out how to find out the public IP address of you NAT (maybe router/Access Point) and send out that IP address.

2-Your service behind a NAT needs to open a client port, or ephemeral port, to communicate with the service outside the NAT. If the second sends the message to the client port from which it received the message, you have to find a way to determine the client port you want to open (must be the same you configured in port forwarding). Will it listen in port 808 by default?

I hope this helps.

Upvotes: 2

Related Questions