我目前正在开发一个需要与 Internet 上的 Web 服务通信的应用程序。 Internet Explorer 是迄今为止唯一通过代理服务器连接到 Internet 的应用程序。
代理设置设置为“使用自动配置脚本”。
我保留了默认设置
<binding useDefaultWebProxy="true" />
另外设置
<security mode="TransportCredentialOnly">
<transport clientCredentialType="Windows" proxyCredentialType="Basic"
realm="" />
<message clientCredentialType="UserName" algorithmSuite="Default" />
</security>
但运气不好。我不断收到“(407) 需要代理身份验证。”
我已经进行了一些 Google 搜索,但解决方案似乎不适合我的情况。
简短更新: 该应用程序应使用默认用户凭据运行,并使用这些凭据 通过 NTLM 向代理进行身份验证。但即使我将客户端设置为这样做,它似乎也无济于事。
最佳答案
保留 <binding useDefaultWebProxy="true" />
设置,并确保 useDefaultCredentials
在您的 app.config 文件中设置为 true(此设置默认为 false
):
<system.net>
<defaultProxy useDefaultCredentials="true"/>
</system.net>
有关详细信息,请参阅我的博客文章“Using HTTP Proxy Servers”。
关于c# - 代理设置设置为 "Use automatic configuration script"的 WCF 客户端,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/5815579/