用户在调用Web服务时收到407代理错误

问题描述:

我已经在C#.net 2.0中开发了一个客户端winform应用程序.该应用程序是通过网络安装的clickonce应用程序.用户可以毫无问题地访问安装网站.

安装后,用户将报告该应用程序正在抛出错误.当查看用户PC上的问题日志时,我发现该应用程序尝试使用Web服务(与clickonce安装文件位于同一服务器上)时,都会收到407代理错误. >
我最初以为,如果用户可以通过浏览器访问安装URL,则笔记本电脑上的应用程序可以访问同一台服务器上的Web服务……这可能是一个错误的假设吗?有任何想法吗?

I have developed a client winform app in C# .net 2.0. The application is a clickonce app that installs via the web. The users can get to the installation website without a problem.

Once installed the users are reporting that the application is throwing an error. When a look at the problem log on the user''s pc, I see that the app is receiving a 407 proxy error whenever it tries to use a webservice (that resides on the same server as the clickonce installation files.)

I originally assumed that if a user could reach the installation URL via their browser, an app on their laptop could reach a webservice on that same server... maybe this is a bad asumption? Any ideas?

访问Web服务时,如果用户位于代理后面(例如公司用来路由所有互联网流量的公司代理),则您需要配置服务以使用代理

这将遵循
的思路
When accessing a web service, if the user is behind a proxy (say a corporate proxy used by a company to route all internet traffic) then you need to cofigure the service to use the proxy

This would be along the lines of
WebService service = new WebService();
IWebProxy proxy = HttpWebRequest.DefaultWebProxy; 
proxy.Credentials = CredentialCache.DefaultCredentials;
service.Proxy = proxy;



这告诉Web服务使用为Internet访问配置的默认代理和凭据.



This tells the web service to use the default proxy and credentials configured for internet access.


Dylan,感谢您的答复.不幸的是,我只是尝试了一下,但没有成功.仍然收到407代理错误.只是为了确保我能正确解释:

用户通过其办公室(位于防火墙后面)连接到Intranet,并且他们正在访问也位于防火墙后面的网站(访问站点时不会提示他们输入密码.)当用户单击链接时转到clickonce安装页面,他们可以轻松访问该网站.安装似乎没有失败...当应用程序启动时会出现问题,它会调用Web服务并抛出407错误.该Web服务与clickonce位于同一服务器上;所以我不知道为什么用户可以访问要安装的URL但不能访问同一域上的Web服务...
Dylan, thanks for the reply. Unfortunately I just tried this and it did not work. still getting a 407 proxy error. Just to make sure I am explaining accurately:

The user connects to the intranet via their office (which is behind the firewall) and they are accessing a website that is also behind the firewall (they are not prompted for a password when they go to the site.) When the user clicks the link to go to the clickonce install page, they have no problem getting to the site. The installation seems to occur without fail... the problem arises when the app starts-up it calls the web service and throws the 407 error. The webservice is on the same server as the clickonce; so I don''t know why a user can access the url to install but can''t access the web service on the same domain...