【发布时间】:2014-09-26 18:27:43
【问题描述】:
我正在使用以下代码调用我的合作伙伴网络服务。此代码运行良好,并且能够从我的 DEV 环境中的合作伙伴那里提取 xml 消息。但是,当我将此代码移动到集成环境时,它会给出错误407 proxy authentication required。当我联系我的网络团队时,他们说,我的代码正在尝试通过代理服务器进行调用。
但是,根据下面的代码,我没有配置任何东西来通过代理服务器调用合作伙伴服务。你能建议一下,我能做什么?
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();
【问题讨论】:
标签: .net web-services https proxy httpwebrequest