title: "Unable to connect to the remote server"
body: <p>I'm able to call a 3rd party vendor's web service from a Windows form program just fine. When I try to call the same web service and web method and same URL from a WCF web service I get the following error: </p>
  
  <pre><code>ExportValuationPolicyNumber:Exception=System.Net.WebException: Unable to connect to the remote server ---&gt; 
  System.Net.Sockets.SocketException: A connection attempt failed because the connected party did not properly 
  respond after a period of time, or established connection failed 
  because connected host has failed to respond 66.77.241.76:80
  
     at System.Net.Sockets.Socket.DoConnect(EndPoint endPointSnapshot, SocketAddress socketAddress)
     at System.Net.ServicePoint.ConnectSocketInternal(Boolean connectFailure, Socket s4, Socket s6, Socket&amp; socket, IPAddress&amp; address, ConnectSocketState state, IAsyncResult asyncResult, Int32 timeout, Exception&amp; exception)
     --- End of inner exception stack trace ---
     at System.Net.HttpWebRequest.GetRequestStream()
     at System.Web.Services.Protocols.SoapHttpClientProtocol.Invoke(String methodName, Object[] parameters)
     at TFBIC.RCT.WCFWebServices.ExpressLync.ValuationServiceWse.ExportValuationPolicyNumber(String PolicyNumber) in c:\Source\TFBIC.RCT.WCFWebServices\TFBIC.RCT.WCFWebServices\Web References\ExpressLync\Reference.cs:line 519
     at TFBIC.RCT.WCFWebServices.ValuationService.ExportValuationPolicyNumber(String PolicyNumber) in c:\Source\TFBIC.RCT.WCFWebServices\TFBIC.RCT.WCFWebServices\ValuationService.svc.cs:line 97
  </code></pre>
  
  <p>I'm basically trying to write a WCF wrapper for the vendor .asmx/WSE3 service.  Let's not get off point - but Microsoft says WCF can call WSE3, but only with SSL turned on, and my vendor - believe it or not - is not allowing SSL connection. So I'mn stuck writing the wrapper so I can call from BizTalk 2009. Right now, I'm testing the wrapper via a Console program.</p>
  
  <p>What can I even do to debug?  I've added EventLog traces before and after the WCF service where it calls the .asmx service - so I know that's where it's blowing (plus the line number in the error above). </p>
  
  <p>I have the following in my web.config:</p>
  
  <pre><code>&lt;microsoft.web.services3&gt;
          &lt;diagnostics&gt;
                  &lt;trace enabled="true" 
                             input="c:\inetpub\wwwroot\wsetraces\InputTrace.webinfo" 
                             output="c:\inetpub\wwwroot\wsetraces\OutputTrace.webinfo" /&gt;
                  &lt;detailedErrors enabled="true" /&gt;
          &lt;/diagnostics&gt;
  &lt;/microsoft.web.services3&gt;
  </code></pre>
  
  <p>and I have given the directory full-access to everyone - yet no trace appears there. </p>
  
  <p>What are some things I can look for or try next to debug this? </p>
  
  <p>In theory "ping" results should not matter, because the website is working from the Windows form program that calls it just fine. </p>
  
  <p>Nevertheless - here is what Ping shows and it looks a little questionable to me: </p>
  
  <p>C:\Users\uxnxw01>ping rct.msbexpress.net</p>
  
  <pre><code>Pinging rct.msbexpress.net [66.77.241.56] with 32 bytes of data:
  Reply from 10.193.99.5: Destination net unreachable.
  Reply from 10.193.99.5: Destination net unreachable.
  Request timed out.
  Reply from 10.193.99.5: Destination net unreachable.
  
  Ping statistics for 66.77.241.56:
      Packets: Sent = 4, Received = 3, Lost = 1 (25% loss),
  </code></pre>
  
  <p>Thanks, </p>
  
  <p>Neal Walters </p>
  
  <p><hr>
  WireShark analysis</p>
  
  <p>I did run Wireshark - posted some results in comment below.  However, after reading it more, it does not always say "Destination Unreachable".  But in the case where it's failing, I never get any databack.  I'm still confused what to do next.  I have been comparing packets but it's slow and confusing.  For instance, I still haven't found the key (a specific policyNum) that I am passing in the request packet.  I also see a few "Destination Unreachable" statements in the one that worked.  </p>
  
  <p>In the one that works, I never see 66.77.241.76, I only see our company's proxy.  But I can't see anything in the config (or code) that would tell WSE3 to use or not use the proxy.  </p>
  
  <p><hr>
  Telnet results:</p>
  
  <pre><code>C:\Users\uxnxw01&gt;telnet 66.77.241.56 80
  Connecting To 66.77.241.56...Could not open connection to the host, on port 80:
  Connect failed
  
  C:\Users\uxnxw01&gt;telnet 66.77.241.76 80
  Connecting To 66.77.241.76...Could not open connection to the host, on port 80:
  Connect failed
  </code></pre>
  
  <p>I'm not sure what this proves.  Like I said, I CAN definitely call the same webservice from a Windows form by directly calling its WSE3 interface.  I know that I can get there that way. </p>
  
  <p>I'm thinking the main differences in the two programs is that one is running under a Win Form and calling WSE3 directly.  That one works.  The one that fails is basically 99% same code, published as a WCF service, so it's running under IIS (then a console program calls the WCF/IIS service on my machine, which in turns calls the WSE3 service). </p>
  
  <p><strong>Is there some reason IIS wouldn't use the same proxy?</strong> </p>