I'm testing a simple c# application with server and client both working on the same machine ,client try to connect to server using external ip but i keep getting this message "No connection could be made because the target machine actively refused it".
I port forwarded my server manually and using UPNP and checked the port and it's open ,all firewalls(windows,software and router) are disabled, utorrent is working already on my machine using UPNP.
so i don know the possible reasons of failing to connect .any suggestions?

Some computers have issues if you do a test from external IP using the same computer due to a NAT conflict. If you want to test simply if your program works, or localhost interface. To do a test between "machines" on a local area network, you can setup a virtual machine (e.g. VirtualBox) and configure the interface as bridged network. A test through internet would be good to do it between two different physical connections.