Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Can't connect to a remote wcf service from IIS

Tags:

iis

wcf

I am able to connect to a remote WCF service from a console or a website/webapplication running on a VS dev server successfully. However, when I try to connect from an IIS hosted website I'm getting the following error. Any idea?

No connection could be made because the target machine actively refused it 12.11.121.12:80

like image 704
VJAI Avatar asked Oct 11 '22 22:10

VJAI


1 Answers

This error:

No connection could be made because the target machine actively refused it

Means that a connection request successfully got through to the target machine (it isn't a firewall issue), on a given port and the target machine was not listening for incoming connections on that port, so the OS refused the connection attempt.

The rest of your error identifies the machine 12.11.121.12 and the port number 80 that the connection was attempted on.

The error indicates that a server isn't running on the target machine. If you know a server is running on the machine you're attempting to connect to, because you can connect to it from another application, then this suggests that your connection details are misconfigured in the website.

So, some things to check:

  • Are there any differences between the app.config/web.config configuration details for the target webservice? Specifically, the machine name (12.11.121.12) and the port number (80) would seem potentials.
  • Are you running the IIS hosted website on the same machine as the console/web application that works? If not, do both machines resolve the target server name (are you using someserver.org for example rather than 12.11.121.12 and it is being resolved to a different IP because one server is external facing and the other is internal?
like image 55
forsvarir Avatar answered Oct 14 '22 00:10

forsvarir