4

i need to run a wcf service in our office server and want to access that service from out side of office. i test the wcf service in LAN and it is working fine. our office has static ip. some one told me that port forwarding is required to access that wcf service from out side of office. i have no access to our office routine and that is why i can enter into router & can not forward any port from there. so i have decided i have to do port forwarding programmatically by c#. so looking for guidance which library i can use to do port forwarding using c#.

if i do not know the router login then a c# program can enable port forwarding ? i like to also know what port forwarding does ? does it save any data in router or any pc?

guide me in details how can i enable port forwarding for my wcf service if i do not have access office router and want to enable the access of wcf service running in a office pc from out side ? looking for great discussion. thanks

updated

i have found one link http://pietschsoft.com/post/2009/02/NET-Framework-Communicate-through-NAT-Router-via-UPnP.aspx

it is using com comonet for port forwarding. i have confusion about the picture they have shown. please have a look and tell me. here is the pic. enter image description here

according to the pic we need to mention external ip, external port and internal ip & port. if my wcf service is running on port 7756 then do i need to specify the same port for external & internal port?

what ip i need to specify as external & internal IP? if machine ip is 192.168.6.2 where my wcf service is running locally and if our office static ip is 122.160.187.236 then how i need to specify ip's for external & internal purpose? please help me with information. thanks

6
  • 1
    Does your program need to do the port forwarding? Or can you use an external program? There are lots of great software packages that already do this for you. Using ssh under Cygwin comes immediately to mind. Commented Jul 2, 2013 at 15:15
  • yes program need to do the port forwarding. Commented Jul 2, 2013 at 15:17
  • I don't think you understand your situation. You don't need your app to do port forwarding, you need someone to change your office's router and/or firewall rules. Commented Jul 2, 2013 at 15:20
  • will u please discuss what rule & settings need to change in office. thanks Commented Jul 2, 2013 at 15:26
  • Note, the program you link to uses UPNP port-forwarding which is a feature of the router and could be disabled. Commented Jul 2, 2013 at 17:14

1 Answer 1

1

http://www.fluxbytes.com/csharp/upnp-port-forwarding-the-easy-way/

It is targeted at Mono but Mono is a compliant CLR and BCL, so it will work on the standard Windows .Net too.

Word of warning: I have not tested that library nor the guide myself.

Port Forwarding tells the router to do something along the lines of: "Whatever traffic comes in via port X is mine, send it to my IP".

More info: https://en.wikipedia.org/wiki/Port_forwarding

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.