c# - 代理设置设置为 "Use automatic configuration script"的 WCF 客户端

标签 c# wcf wcf-binding

我目前正在开发一个需要与 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/

相关文章:

c# - 条件断点不起作用

c# - 为什么修改本地数据时yield return不起作用?

c# - 删除 WCF 服务答案的大小限制

c# - 如何向 RESTful WCF 服务传递和使用 JSON 参数?

c# - Golang 使用 AES 加密数据

c# - WCF 使用 net.tcp 绑定(bind)

wcf - 停止 WCF 将空 ICollection 反序列化为零容量阵列

xml - WCF 是否总是使用 SOAP 通过您的绑定(bind)发送信息?

c# - WCF 消息凭证实现细节

Azure 上的 WCF REST 失败并显示 "413 Request Entity Too Large"