这是代码:
var webProxy = new WebProxy(new Uri("http://127.0.0.1:8888")) { BypassproxyOnLocal = false }; var bypassed = webProxy.IsBypassed(new Uri("http://127.0.0.1")); Console.WriteLine(bypassed);
输出:true
MSDN声明如下:
The IsBypassed method is used to determine whether to bypass the proxy
server when accessing an Internet resource.The BypassproxyOnLocal and BypassList properties control the return
value of the IsBypassed method.IsBypassed returns true under any of the following conditions:
If BypassproxyOnLocal is true and host is a local URI. Local requests
are identified by the lack of a period (.) in the URI,as in
“http://webserver/”.If host matches a regular expression in BypassList.
If Address is null.
All other conditions return false.
解决方法
请参阅fiddler网站上的Monitor traffic to localhost from IE or .NET解释如何处理它.
原文地址:https://www.jb51.cc/csharp/100910.html
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。