转WCF Proxy Authentication Required
2014-01-14 13:00
302 查看
WCF Proxy Authentication Required
The Problem
When I’m in the office, I have to use an authenticated proxy to get outside our intranet and to the internet. When I called a service that resides on the web, I got the 407 error. How can we fix this without having to provide an account to our application?The Solution
The answer is actually pretty simple. The answer has nothing to do with WCF, but everything to do with System.Net.System.Net’s default web proxy does not have the UseDefaultCredentials flag switched on by default. It’s false. Creating a new WebProxy object with the flag set to true is problematical… it turns out to be quite hard to find out the address and port of the default web proxy at runtime, because this is essentially a dynamic thing, and not (as previously thought in the .NET 1.x era) a static thing.
So by far the best thing to do is use your app’s App.Config file to tell System.Net to use the default credentials for authentication to an HTTP proxy server. Something like this:
<system.net>
<defaultProxy useDefaultCredentials="true">
<proxy autoDetect="True"/>
</defaultProxy>
</system.net>
A nice article that helped me out: http://sticklebackplastic.com/post/2007/01/26/Poxy-proxies.aspx
相关文章推荐
- Proxy Authentication Required解决
- Proxy Authentication Required解决
- 407 Proxy Authentication Required
- Proxy Authentication Required ( Forefront TMG
- python 3 urllib Proxy Authentication Required
- centos 6.3 使用 vnc xrdp 远程登陆 不断弹出对话框“ Authentication is required to set the network proxy used for downloading packages ”
- C# 调用 Web Service 时出现 : 407 Proxy Authentication Required错误的解决办法
- Proxy Authentication Required解决
- 解决linux下非root用户频繁出现Authentication is required to set the network proxy used for downloading packages
- HttpWebRequest WebExcepton: The remote server returned an error: (407) Proxy Authentication Required.
- Authentication is required to set the network proxy used for downloading packages
- Disabling Apache Httpclient -- fix eclipse proxy bug -- "proxy authentication required"
- pip install 出现407 proxy authentication required 解决方案(Windows)
- 407 Proxy Authentication Required
- redis报错(error) NOAUTH Authentication required.
- Redis (error) NOAUTH Authentication required解决方法
- Transaction visibility / proxy / propagation REQUIRED and REQUIRES_NEW
- Remoting and Proxy Authentication(不懂的问题_需要研究)
- Send Error:不允许使用邮箱名称。 服务器响应为: You are not authorized to send mail, authentication is required
- How to create a generic WCF service proxy ?