title: Web service in Asp 1.1 not working on http://localhost/ but working from Visual Studio http://localhost:14475/
body: <p>I need to consume a 3rd party web service. My environment: Asp 1.1, IIS 5.1, IE 7+ and behind a proxy server. I am facing a problem with authentication.</p>
  
  <p>Step 1: I have successfully added the web service - by providing my authentication details for our proxy server.</p>
  
  <p>Step 2: code used to consume the service</p>
  
  <pre><code>WebProxy proxyObject = new WebProxy("PROXY SERVER URI:PORT/", true);
  proxyObject.Credentials = CredentialCache.DefaultCredentials;
  myObj.Credentials = System.Net.CredentialCache.DefaultCredentials;
  myObj.Proxy = proxyObject;
  </code></pre>
  
  <p>Step 3: Response I got: "The remote server returned an error: (407) Proxy Authentication Required."
  Step 4: I changed code in Credentials to:</p>
  
  <pre><code>proxyObject.Credentials = new NetworkCredential("UID", "PASSWORD");
  </code></pre>
  
  <p>Step 5: Result: Proper result.</p>
  
  <p>I also found this: even though I need to work in 1.1, but when I tried to use in 2.0:
  Step 1: Code used:</p>
  
  <pre><code>myObj.Proxy = WebRequest.DefaultWebProxy;
  myObj.Credentials = System.Net.CredentialCache.DefaultCredentials;
  myObj.Proxy.Credentials = System.Net.CredentialCache.DefaultCredentials;
  </code></pre>
  
  <p>Step 2: Its working fine as <code>http://localhost:14475/TransUnion_VS2008/HostWS_FW.asmx?op=TURequest</code> with a port number when I run from VS2008</p>
  
  <p>Step 3: But the same code is not working as <code>http://localhost/TU_HostWS/Service.asmx</code>, when I run from IIS. It threw below error message:</p>
  
  <p>System.Net.WebException: Unable to connect to the remote server ---> 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 XXX.XXX.XXX.XXX:XXX 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&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(TransportContext&amp; context) at System.Net.HttpWebRequest.GetRequestStream() at System.Web.Services.Protocols.SoapHttpClientProtocol.Invoke(String methodName, Object[] parameters) at TU_Prod.CreditReport.ProcessRequestXMLV2(TUCANREL4 TUCANREL4, REL4Report&amp; REL4Report) at Service.TURequest()</p>
  
  <p>Step 4. It is working from IIS <code>http://localhost/TU_HostWS/Service.asmx</code> only when I change the code and provide my authentication details as:</p>
  
  <pre><code>proxyObject.Credentials = new NetworkCredential("UID", "PASSWORD");
  </code></pre>
  
  <p>Can you please help me in this? I tried with IIS “not set to Windows, BASIC or Digest, but only as Anonymous” But no luck. Please help..</p>