The remote name could not be resolved - webclient

做~自己de王妃 提交于 2019-12-04 03:29:12

Most likely the other location you run the code on indeed does not have access to that remote location. I.e. in many corporate environment servers aren't allowed outside Internet access. You may want to try to ping/traceroute russgates85-001-site1.smarterasp.net from that other server and if there's no access - configure router/firewall (open port etc.) or use proxy

I ran into this and needed to use the IP of the remote server rather than the DNS name. Production was trying to access the remote server using its DNS name, which was not viable on that side of the firewall.

I had the same issue and got it resolved by setting the Proxy for the webclient

explicitly like

 webClient.Proxy = new WebProxy("myproxy.com:portnumber"); 
 byte[]  bytearr= webClient.DownloadData(acsMetadataEndpointUrlWithRealm);
Kamarajan Chandran

By default it will take system proxy.

To solve this, force to set your proxy in web.config or .cs api webclient.

Code fix should be like following, In under System.net section in web.config

<defaultProxy>

<proxy proxyaddress="http://0.000.000.000:00" bypassonlocal="True" usesystemdefault="False" autoDetect="False" />

</defaultProxy>
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!