无法解析远程名称:'staging.www.wwalliance.com' [英] The remote name could not be resolved: 'staging.www.wwalliance.com'
问题描述
我在我的应用程序中使用一个休息服务。当我运行解决方案时一切正常工作
但是当我发布解决方案并浏览它时抛出以下错误。
我尝试了什么,
1.在web.config中添加以下代码
I am using one rest service in my application. when I run the solution everything working fine
but when I publish the solution and browse it throwing the below error.
What all I tried ,
1. added below code in web.config
<system.net>
<defaultProxy enabled="true" useDefaultCredentials="true">
<proxy usesystemdefault="True"/>
</defaultProxy>
</system.net>
2.在互联网工具上添加到可信站点的网址http://staging.www.wwalliance.com
3.用于代理互联网工具并绕过它
http:// staging .www.wwalliance.com \ *
仍然没用,请你帮忙。
应用程序中使用的代码如下,
2. on internet tool added into trusted site the url http://staging.www.wwalliance.com
3. whet to proxy at internet tools and bypassed it with
http://staging.www.wwalliance.com\*
still no use, could you please help.
code which is used in application is below,
string CallOriginMethod()
{
string uri = "http://staging.www.wwalliance.com/webservice/rest/globalrateorigin/origin.xml?";
string Method = "POST";
HttpWebRequest req = WebRequest.Create(uri) as HttpWebRequest;
req.KeepAlive = false;
req.Method = Method.ToUpper();
if (("POST,PUT").Split(',').Contains(Method.ToUpper()))
{
string stringxml = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>" +
" <GlobalrateoriginRequest xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xsi:noNamespaceSchemaLocation=\"WWA_Rate_Lookup_origins_request_version_2.0.1.xsd\">" +
"<GlobalrateoriginEnvelope><SenderID>test_agility</SenderID><ReceiverID>restapi</ReceiverID><Password>01870fa4b08a1</Password><Type>Globalrate_Origin_Request</Type> " +
"<Version>2.0.1</Version><EnvelopeID>123</EnvelopeID></GlobalrateoriginEnvelope><GlobalrateoriginRequestDetails><Date>2013-04-25</Date><Customeralias>AGILITY</Customeralias>" +
"</GlobalrateoriginRequestDetails></GlobalrateoriginRequest>";
byte[] buffer = Encoding.ASCII.GetBytes(stringxml);
req.ContentLength = buffer.Length;
req.ContentType = "text/xml";
Stream PostData = req.GetRequestStream();
PostData.Write(buffer, 0, buffer.Length);
PostData.Close();
}
// declare & read response from service
HttpWebResponse resp = req.GetResponse() as HttpWebResponse;
// set utf8 encoding
Encoding enc = System.Text.Encoding.GetEncoding(1252);
// read response stream from response object
StreamReader loResponseStream = new StreamReader
(resp.GetResponseStream(), enc);
String strResult = string.Empty;
// read string from stream data
strResult = loResponseStream.ReadToEnd();
// close the stream object
loResponseStream.Close();
// close the response object
resp.Close();
return strResult;
}
我们在页面加载时调用的方法如下所示
that method we are calling on page load as below
var docs = XElement.Parse(CallOriginMethod());
推荐答案
亲爱的,谢谢你的回复。我得到了解决方案。
问题是,当我在IIS上部署时,我可以通过我的帐户详细信息,我还没有完成,这不允许我浏览网址。
如果不清楚,请随时联系我以获取详细信息。
Dear All, Thank you for your reply. I got the solution.
The issue was, when i deployed on IIS , I could have pass my account details, which i haven''t done and that was not allowing me to browse the url.
Please reach me anytime for detailed info, if not clear.
这篇关于无法解析远程名称:'staging.www.wwalliance.com'的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!