Unable to connect to the remote server

When attempting to call a webservice that lives outside my corperate firewall I was getting the following error:

System.Net.WebException was unhandled by user code
  Message="Unable to connect to the remote server"
  Source="System"
  StackTrace:
       at System.Net.HttpWebRequest.GetRequestStream()
       at System.Web.Services.Protocols.SoapHttpClientProtocol.Invoke(String methodName, Object[] parameters)

After some research I stumbled across this post by Rick Strahl
http://west-wind.com/weblog/posts/3871.aspx

but my problem was a little bit different. In his case he desired to disable to the automatic proxy detection, but I needed to wire in the script that my corperate IT department requires that we use. Easy enough just add the following to the web.config

 <system.net>
  <defaultProxy>
   <proxy scriptLocation ="url to script here" />
  </defaultProxy>
 </system.net>

I think the cause of my problem was the same as Ricks. Everything works fine when using a console application running as me, but when I put the same method call in a web app runing as network service it appears that he doesnt have enough permissions to get the script location from the registry.

Published Monday, December 03, 2007 5:28 PM by sweisfeld
Filed under: , ,

Comments

No Comments