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)
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.
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.
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.
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”
- Or Open the Internet Explorer and click the Tools button.
- Click on Internet Options and then click on the Connections tab.
- Click “LAN settings”.
- 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.