views:

28

answers:

1

"Not this again" I hear you say. Yeah, I know. But this one is different... I think.

The scenario: I have a Windows service (running as SYSTEM) that consumes a remote WCF service. The machine sits behind an ISA proxy (no domain, and no proxy username/pwd) and I have added the proxy to my app.config. Here it is:

<system.net>
  <defaultProxy useDefaultCredentials="true">
    <proxy 
        bypassonlocal="False" 
        proxyaddress="http://myproxyserver:8080"
        usesystemdefault="False" />
  </defaultProxy>
</system.net>

The exception:

System.Net.WebException: 
  The remote server returned an error: (407) Proxy Authentication Required.
  at System.Net.HttpWebRequest.GetResponse()
  at System.ServiceModel.Channels.HttpChannelFactory.HttpRequestChannel. ...
     HttpChannelRequest.WaitForReply(TimeSpan timeout)

Why this is different? I have changed the service to run as an Administrator, and the Windows service was able to access the WCF service perfectly. Unfortunately I need to use the SYSTEM account, as the service runs some legacy COM+ stuff, which requires the "Allow service to interact with desktop" option to be set. (This option is only available for the SYSTEM account)

Another reason why this is strange is that SYSTEM is supposed to be the big daddy almighty account (more here)

What I've tried: I've tried this, this, and this... and then some.

This one is a bit of a mystery. Why would my app.config work for administrator, but not for SYSTEM?

Thanks for the help!

A: 

Found the problem. Turns out it had nothing to do with the account. As the timeout period was quite long, I did not always see this exception immediately, which led me to think that it had something to do with the account being used.

The problem was that useDefaultCredentials was set to false on the production site. Fail.

Andy