.Net 默认代理设置
如果我有一个需要调用 Web 服务的客户端应用程序。 我想知道如果我在 app.config 文件中将默认代理属性设置为 true 或 false 的优点/缺点和影响? 谢谢!
这是我正在谈论的财产。
http://msdn.microsoft.com/en-us/library/kd3cf2ex。 aspx
问候, 乔治
If I have a client application which needs to call a web service. I want to know the pros/cons and impact if I set default proxy property to true or false in app.config file? Thanks!
Here is the property I am talking about.
http://msdn.microsoft.com/en-us/library/kd3cf2ex.aspx
regards,
George
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
也可以在机器范围的 .net 配置文件中设置此设置(如果在两个地方都配置了,则以您的 app.config 设置为准)
请注意,如果您处于部分信任环境中,则无法设置此设置(因此请注意单击一次部署)。
也就是说,如果您设置了该设置,则所有 http 和 https 调用都将使用默认的 Internet 代理。 这不涉及其他网络连接(例如 tcp),即使您在 Internet 选项中配置了袜子服务器。
如果没有默认代理设置,则该设置没有影响,因此通常最好使用它(除非您想显式绕过代理并进行直接连接)
This setting can also be setted in the machine-wide .net configuration file (If it's configured in both places, your app.config setting will prevail)
Please note that you cannot set this setting if you're in a partial trust environment (so beware of click-once deployments)
That being said, if you set the setting, all http and https calls will use the default internet proxy. This doesn't concern other network connections (tcp for example), even if you've configured a socks server in the Internet Options
If there's no default proxy set, the setting has no impact, so it's usually a good idea to use it (unless you want to explicitly bypass the proxy and make a direct connection)
我个人会将其设置为客户端应用程序中的设置/选项对话框,以便用户可以获取默认值,或使用用户名和密码设置自己的代理服务器。 这样就没有出错的余地。
I would personally make it a settings/options dialog in the client application so the user can either grab the default, or set their own proxy server with username and password. This way there is no room for error.
您可能会遇到没有默认代理服务器但无法直接连接的情况,例如在公司防火墙内运行的无人值守的 Windows 服务中,或者当某人尚未设置 Internet Explorer 时。 因此,我将具有使用默认代理的默认行为,但在配置文件中有一个属性允许用户覆盖它。
默认代理服务器存储在注册表中:
You may run into situations where there is no default proxy server but you can't connect directly, e.g. in an unattended Windows service running inside a corporate firewall, or when someone hasn't set up internet explorer. For this reason I would have the default behaviour as using the default proxy, but have a property in the config file allowing the user to override this.
The default proxy server is stored in the registry under: