HTTPS - 407需要代理验证

问题描述:

我正在使用下面的代码拨打我的合作伙伴webservice的电话。此代码工作正常,并能够从我的合作伙伴在DEV环境中的XML消息。但是,当我将此代码移到INTEGRATION Environment时,它会给出错误407需要代理验证。当我联系我的网络团队时,他们说,我的代码尝试通过代理服务器进行呼叫。HTTPS - 407需要代理验证

但是,根据下面的代码,我没有配置任何东西来通过代理服务器调用合作伙伴服务。你能建议,我能做些什么?

NetworkCredential creds = new NetworkCredential(); 

creds.UserName = "partner_client"; 
creds.Password = "dfasnc9d3"; 
HttpWebRequest hwRequest = (HttpWebRequest)HttpWebRequest.Create("https://res.dfadator.com/rest/requests/recent"); 
hwRequest.ContentType = System.Configuration.ConfigurationManager.AppSettings.Get("ContentType"); 
hwRequest.Method = System.Configuration.ConfigurationManager.AppSettings.Get("Method"); ; 

hwRequest.Credentials = creds; 

// Parse the Response. 
webResponse = (HttpWebResponse)hwRequest.GetResponse(); 

上述方法调用代理服务器,如果代理服务器设置启用了UseProxy。
我在拨打电话的同时绕过代理服务器解决了此问题。

string sProxyWebAddress = null; 
System.Net.WebProxy wbProxy = new System.Net.WebProxy(sProxyWebAddress, true); 
hwRequest.Proxy = wbProxy; 
wbProxy = null;