BizTalk Server WCF adapter: Unable to connect to the remote server. System.Net.Sockets.SocketException: No connection could be made because the target machine actively refused it 127.0.0.1:8888

First of all, Happy birthday BizTalk Server for your 16th birthday! For does who don’t remember, the first version of BizTalk Server was released in 12/12/2000, Congratulations!!

Continuing with the topic of my last posts “Errors and Warnings, Causes and Solutions”, we will talk about an error that I face today using the BizTalk Server WCF adapter while trying to communicate with an external WCF service:

System.ServiceModel.EndpointNotFoundException: There was no endpoint listening at http://<ip/host name>/<ServiceName>.svc that could accept the message. This is often caused by an incorrect address or SOAP action. See InnerException, if present, for more details. —> System.Net.WebException: Unable to connect to the remote server —> System.Net.Sockets.SocketException: No connection could be made because the target machine actively refused it 127.0.0.1:8888
at System.Net.Sockets.Socket.EndConnect(IAsyncResult asyncResult)
at System.Net.ServicePoint.ConnectSocketInternal(Boolean connectFailure, Socket s4, Socket s6, Socket& socket, IPAddress& address, ConnectSocketState state, IAsyncResult asyncResult, Exception& exception)

— End of inner exception stack trace —

at System.Net.HttpWebRequest.EndGetRequestStream(IAsyncResult asyncResult, TransportContext& context)
at System.ServiceModel.Channels.HttpOutput.WebRequestHttpOutput.GetOutputStreamAsyncResult.CompleteGetRequestStrea

BizTalk WCF Adapter Unable to connect to the remote server

If this problem happens, it normally means that the IP address or hostname specify in the URL exists but: it has no services listening on the specified port or there is a firewall stopping you.

However, I try to open the URL using the browser on the BizTalk machine and I was able to access without any problem, which means, it wasn’t a firewall problem and the service exist on that specific port.

Causes

Again, this type of problem normally means that the IP address or hostname specify in the URL exists but:

  • It has no services listening on the specified port;
  • Or there is a firewall stopping you.

But… it also can be a proxy problem that may be blocking access to the service! In fact, this was my problem.

Solution

I will not address the first two possible causes here, instead, I will focus on what was my problem, proxies, and how can you solve it.

On the HTTP Transport bindings of the WCF adapter there are several properties to control the proxy, like:

  • proxyAddress: A URI that specifies the address of the HTTP proxy. If useSystemWebProxy is true, this setting must be null. The default is null.
  • proxyAuthenticationSchema: Specifies the protocol used for authenticating client requests being processed by an HTTP proxy. The default is Anonymous.
  • bypassProxyOnLocal: A Boolean value that indicates whether to bypass the proxy server for local addresses. The default is false.

and other properties. But also, contains a very important property: useDefaultWebProxy – this is a Boolean value that specifies whether the machine-wide proxy settings are used rather than the user-specific settings. The default is true.

BizTalk WCF Adapter useDefaultWebProxy true

But how can you know there is a proxy set on the server?

You can check this using one of these two options:

  • You can open Command Prompt (CMD) and type the following command:

reg query “HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Internet Settings” | find /i “proxyserver”

BizTalk WCF Adapter check if proxy is set
  • Or Open the Internet Explorer and click the Tools button.
    • Click on Internet Options and then click on the Connections tab.
    • Click “LAN settings”.
BizTalk WCF Adapter check if proxy is set in internet explorer
  • You can also click “Advanced” to check more details

If you notice in the pictures there is a default proxy set on the server and there are some exceptions defined in the Internet Explorer, a few names and some IPs. One of this IP’s was, in fact, the IP of the machine that was hosting the service that I was trying to communicate.

In my case to solve the problem I just need to set the useDefaultWebProxy property in the HTTP transport bindings of my WCF port to false.

BizTalk WCF Adapter useDefaultWebProxy false
Author: Sandro Pereira

Sandro Pereira lives in Portugal and works as a consultant at DevScope. In the past years, he has been working on implementing Integration scenarios both on-premises and cloud for various clients, each with different scenarios from a technical point of view, size, and criticality, using Microsoft Azure, Microsoft BizTalk Server and different technologies like AS2, EDI, RosettaNet, SAP, TIBCO etc. He is a regular blogger, international speaker, and technical reviewer of several BizTalk books all focused on Integration. He is also the author of the book “BizTalk Mapping Patterns & Best Practices”. He has been awarded MVP since 2011 for his contributions to the integration community.

1 thought on “BizTalk Server WCF adapter: Unable to connect to the remote server. System.Net.Sockets.SocketException: No connection could be made because the target machine actively refused it 127.0.0.1:8888”

Leave a Reply

Your email address will not be published. Required fields are marked *

BizTalk360
BizTalk Server

Over 500+ customers across
30+ countries depend on BizTalk360

Learn More
Serverless360
Azure

Manage and monitor serverless
components effortlessly

Learn More
Atomicscope
Business Users

Monitor your Business Activity in iPaaS
or Hybrid integration solutions

Learn More

Back to Top