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

  • Sandro Pereira
  • Dec 12, 2016
  • 4 min read

First of all, Happy birthday BizTalk Server for your 16th birthday! For those who don’t remember, the first version of BizTalk Server was released on 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 occurs, it usually means that the IP address or hostname specified in the URL exists, but no services are listening on the specified port, or a firewall is blocking you.

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

📝 One-Minute Brief

This post explains how to troubleshoot a BizTalk Server WCF adapter connection error where the target machine refuses the connection, showing that the root cause may be a proxy configuration issue, not the service endpoint or firewall.

Causes

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

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

But… it could also be a proxy issue 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 my problem was, proxies, and how you can 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 to authenticate client requests 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 it also contains a very important property: useDefaultWebProxy – a Boolean value that specifies whether machine-wide proxy settings are used rather than 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 Internet Options, then click 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 look at the pictures, there is a default proxy set on the server, and there are some exceptions defined in 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
#1 all-in-one platform for Microsoft BizTalk Server management and monitoring

This post explains how to troubleshoot a BizTalk Server WCF adapter connection error where the target machine refuses the connection, showing that the root cause may be a proxy configuration issue, not the service endpoint or firewall.

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 *

The Ultimate Cloud
Management Platform for Azure

Supercharge your Azure Cost Saving

Learn More
Turbo360 Widget

Back to Top