ar0*_*968 18 c# ssl proxy http visual-studio
我正在尝试创建一个C#代理DLL,允许VS2015社区在我的离线工作站上通过具有身份验证的公司HTTP代理访问Internet.
按照这篇MSDN博客文章的说明, 我能够以这种方式将VisualStudio连接到HTTP页面:
namespace VSProxy
{
public class AuthProxyModule : IWebProxy
{
ICredentials crendential = new NetworkCredential("user", "password");
public ICredentials Credentials
{
get
{
return crendential;
}
set
{
crendential = value;
}
}
public Uri GetProxy(Uri destination)
{
ServicePointManager.ServerCertificateValidationCallback = (Header, Cer, Claim, SslPolicyErrors) => true;
return new Uri("http://128.16.0.123:1234", UriKind.Absolute);
}
public bool IsBypassed(Uri host)
{
return host.IsLoopback;
}
}
}
Run Code Online (Sandbox Code Playgroud)
但我无法连接到Visual Studio社区访问的帐户身份验证页面.
所以,我正在尝试使用DLL验证Microsoft证书.
我有什么方法可以完成HTTPS和证书问题?
如何验证webProxy DLL中的证书?
小智 1
您可能有公司提供的 SSL 代理证书。您只需将其导入 IE 中的根证书即可(即http://www.instructables.com/id/Installing-an-SSL-Certificate-in-Windows-7/、https://bto.bluecoat.com/webguides /sslv/sslva_first_steps/Content/Topics/Configure/ssl_ie_cert.htm )
或者只是忽略通过 .Net 配置的证书验证
如何在 web.config 中设置 ServicePointManager.ServerCertificateValidationCallback
如何使用 WCF 服务暂时停止证书错误(OzrenTkalcecKrznaric 的回答)
对于 Visual Studio 2015,.Net 配置文件位于“%PROGRAMFILES(x86)%\Microsoft Visual Studio 14.0\Common7\IDE\devenv.exe.config”。
我希望它有帮助。
| 归档时间: |
|
| 查看次数: |
501 次 |
| 最近记录: |