Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

WCF client with proxy settings set to "Use automatic configuration script"

I'm currently developing an application that needs to communicate with a webservice on the internet. Internet explorer is until know the only application that is connecting to the internet through a proxy server.

The proxy settings are setup to "Use automatic configuration script".

I have kept the default setting

<binding useDefaultWebProxy="true" />

And additionally set

<security mode="TransportCredentialOnly">
        <transport clientCredentialType="Windows" proxyCredentialType="Basic"
          realm="" />
        <message clientCredentialType="UserName" algorithmSuite="Default" />
</security>

But no luck. I keep getting "(407) Proxy Authentication Required."

I have done some Google-ing, but the solutions do not seem to fit my situation.

Short update: The application should run with the default user credentials, and use those credentials through NTLM to authenticate with the proxy. But even when I set the client to do that it doesn't seem to help.

like image 1000
Saab Avatar asked Apr 28 '11 08:04

Saab


People also ask

How do I use automatic configuration script proxy?

On the Tools menu, click Internet Options, and then click Connections. Click Settings or LAN Settings. In the Automatic configuration area, check that you've chosen the Use automatic configuration script box, and that it has the correct location to your automatic configuration script or for your automatic proxy URL.

What is client proxy in WCF?

Proxy is an object in memory on the client-side that exposes the same Interface or API that the WCF service does. Your consuming code will make calls against that proxy and proxy will dispatch those calls as SOAP Messages to the WCF service.


2 Answers

Keep the <binding useDefaultWebProxy="true" /> setting, and make sure useDefaultCredentials is set to true in your app.config file (this setting is false by default):

<system.net>
    <defaultProxy useDefaultCredentials="true"/>
</system.net>

For more information, see my blog post "Using HTTP Proxy Servers".

like image 68
Bradley Grainger Avatar answered Sep 22 '22 13:09

Bradley Grainger


I can't give you any background on why but setting:

<binding useDefaultWebProxy="false" />

Works for me in my current environment when getting your exact error. Everyting in Windows seems to use the IE-configurable internet settings which include the default proxy. Internet explorer fixes this up for you neatly when running but if you try to retrieve the service wsdl or so using Firefox I´m guessing you would end up having a user login prompt.

In any case, try to false the default proxy.

like image 35
Almund Avatar answered Sep 21 '22 13:09

Almund