WCF basicHttpBinding and proxy with windows authen

2019-07-17 07:41发布

I have an application that connect to an external web service.

The application works fine but with one client I can't get through their proxy.

Since the proxy is configured on the computer i started with

<binding useDefaultWebProxy="true" ... >

With this I get the error message:

The remote server returned an error: (407) Proxy Authentication Required.

Then I tried to add:

    <security mode="Transport">
        <transport proxyCredentialType="Windows"
                   realm="" />
    </security>

but the error message did not change

With some googling I found out that the default setting is to not send credentials to the proxy. The following setting is supposed to enable sending credentials:

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

However, I now get another error message:

Insufficient permissions for setting the configuration section 'defaultProxy'. Request for the permission of type 'System.Net.WebPermission, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089' failed.

I don't understand this message. The application is running on the local computer so it should have full trust. Checked with caspol -m -l and it shows

1.  All code: Nothing
  1.1.  Zone - MyComputer: FullTrust

Now I am out of ideas.

I don't know how to add WebPermission to an assmebly running on the local computer and I don't know if this solves the original problem with proxy authentication.

Some other details which I don't know if it matters.

  • Windows 7 64-bit
  • webservice uses https (I can reach the service via internet explorer)
  • user is local admin

0条回答
登录 后发表回答