什么是正确的方式来处理代理自动配置脚本,以在.NET中Web服务调用?脚本、正确、方式、Web

由网友(欠抽)分享简介:我使用.NET 2.0做一个简单的Web服务调用。从大多数机器,我不需要做什么特别的事情。然而,一个客户端是使用代理自动配置脚本,企业网络上。刚才的一切我能找到的(例如http://msdn.microsoft.com/en-us/magazine/cc300743.aspx#S3)告诉我,我不应该需要做任何事情。.N...

我使用.NET 2.0做一个简单的Web服务调用。从大多数机器,我不需要做什么特别的事情。然而,一个客户端是使用代理自动配置脚本,企业网络上。刚才的一切我能找到的(例如http://msdn.microsoft.com/en-us/magazine/cc300743.aspx#S3)告诉我,我不应该需要做任何事情。.NET会从注册表中读取代理服务器设置,只是工作。对,没错。

I'm using .NET 2.0 to make a simple webservice call. From most machines, I don't need to do anything special. However, one client is on a corporate network that uses a proxy autoconfig script. Just about everything I can find (e.g. http://msdn.microsoft.com/en-us/magazine/cc300743.aspx#S3) tells me that I shouldn't need to do anything. .NET will read the proxy settings from the registry and "just work". Yeah right.

如果客户端使用浏览器首先访问web服务的URL,然后我的web服务调用做的工作。然而,一段时间后,Web服务调用停止与一个407(需要代理身份验证)错误的工作。

If the client uses their browser to visit the webservice URL first, then my webservice call does work. However, after some period of time the webservice calls stop working with a 407 (Proxy Authentication Required) error.

我已经试过明确设置代理(所建议的http://stackoverflow.com/questions/284511/get-proxy-configuration-before-accessing-an-external-webservice-net-2-0),但还没有任何运气。

I've tried explicitly setting the proxy (as suggested by http://stackoverflow.com/questions/284511/get-proxy-configuration-before-accessing-an-external-webservice-net-2-0), but haven't had any luck.

我发现这个 MS知识库文章的信息在WinHTTP.DLL调用WinHttpGetProxyForUrl。如果我拉autoconfigurl列明的注册表,并用它打电话给WinHttpGetProxyForUrl,似乎工作,但它只是似乎是错误的必须去那里。有谁知道正确的方式来获取.NET使用默认的IE代理自动配置脚本?谢谢你。

I found this MS knowledgebase article with information on calling WinHttpGetProxyForUrl in WinHTTP.DLL. If I pull the autoconfigurl setting out of the registry and use it in a call to WinHttpGetProxyForUrl, it seems to work, but it just seems wrong to have to go there. Does anyone know the "right way" to get .NET to use the default IE proxy autoconfig script? Thanks.

推荐答案

不管是不是它应该工作,我不依赖于自动配置脚本的Web服务。那些旨在为Web浏览器配置代理服务。

Whether or not it's supposed to work, I'd not to depend on auto-config scripts for web services. Those are meant to configure proxy services for web browsers.

IT组织应该弄清楚哪个代理将被使用的特定机器上,对于特定的Web服务,并将其设置在配置文件中。

The IT organization should figure out which proxy is to be used on that particular machine, for that particular web service, and set it in the config file.

阅读全文

相关推荐

最新文章