views:

768

answers:

2

I've got a rather confusing problem.

Web Service A - Called directly by Win32 App, and various other web applications
Web Service B - Called directly by same Win32 App and a different set of other Web Applications

I'm working on adding a reference to B into A, so that we can use the functionality B provides without rewriting/reintegrating that code manually into A. I have a develop copy of A on my PC that I'm working with, and am calling a test copy of B on a remote server (the test server is accessed over the internet at our hosting provider)

I believe to have my code ready for testing, but every time I go to test it on my local copy, I get the following error.

No connection could be made because the target machine actively refused it 10.1.X.XX:8080

at System.Net.Sockets.Socket.DoConnect(EndPoint endPointSnapshot, SocketAddress socketAddress)
at System.Net.Sockets.Socket.InternalConnect(EndPoint remoteEP)
at System.Net.ServicePoint.ConnectSocketInternal(Boolean connectFailure, Socket s4, Socket s6, Socket& socket, IPAddress& address, ConnectSocketState state, IAsyncResult asyncResult, Int32 timeout, Exception& exception)

The internal IP listed in the error message was our old BorderManager gateway. It is no longer in use, I've checked all Machine.Configs, Web.Configs, registry entries, even gone so far as doing a full text search of all files on my PC under 2MB for the IP listed there. I double checked the Internet Options Connections settings, but that is managed by a group policy company wide. I've called in a networking guy to verify that the IP is not listed anywhere in the currently applied policy.

I can't find it anywhere except when trying to step over the code that uses it, and getting the exception shown above.

The code I have for using Web Service B is:

 Dim oZip As New ZipTerr.ZIPTerr
 oZip.Url = "https://test.test.com/ZIPTerr/ZIPTerr.asmx" ' This really shouldn't be hardcoded...
 oZip.PreAuthenticate = True
 oZip.Credentials = New System.Net.NetworkCredential("username", "password")
 aCity = oZip.GetCities(pstrZip, Date.Now())

It fails on the call to oZip.GetCities() with the above error. The IP in the error message does not in any way indicate it's made it out of our local network, it's a 10.* private IP, whereas the test server has a valid live publicly accessible IP.

Any ideas??

Update: Both web services are in .NET 2.0

+2  A: 

The underlying System.Net libraries will not be using the Internet Settings values in this case since the code is running as a service.

MS are a little sketchy on the details of how its proxy settings are derived in the absence of specific settings in the .config files.

Here are some things to try:-

One command line use:-

 ProxyCfg -d

This would remove any proxy settings used by the WinHTTP component (which was designed to be used in just such a server setting by code prior to the advent of .NET).

 ProxyCfg -u

Copies the current users Internet proxy settings to the system-wide setting used by WinHTTP.

Better yet configure the proxy settings yourself in the web.config of the calling application:-

<system.net>
  <defaultProxy enabled="true">
     <!-- if above set to true configure below accordingly if false delete below-->
     <proxy proxyaddress="http://127.0.0.1:8888" bypassonlocal="False"/>
  </defaultProxy>
</system.net>
AnthonyWJones
I was able to fix it by using the snippet in the Web.config and setting enabled="false". Thanks for your help!
Josh W.
A: 

Best Guess:

Either the error is coming from code that is not on your machine. Is Web service A and B running on your machine?

Or it is hard coded in a dll where the source for the dll is not on your machine.

Hope this helps

Shiraz

Shiraz Bhaiji