ASP.NET Exception: The remote name could not be re

2019-02-13 14:08发布

As the title suggests, I'm getting the following exception from an ASP.NET page

The remote name could not be resolved: 'apiconnector.com'

I can however navigate to this address from a browser, so I know it's accessible.

Why can't ASP.NET navigate to this address?

EDIT: How am I "navigating" exactly?

Ok so basically I've imported a WSDL as a service reference. All I am doing is calling the methods from the service reference. It's the service reference that does the actual navigation.

Service reference configuration contains the following XML

  <endpoints>
    <endpoint ... address="http://apiconnector.com/API.asmx" ... />
  </endpoints>

3条回答
Animai°情兽
2楼-- · 2019-02-13 14:44

I finally managed to get this working, with the help of a colleague. The problem only occurs in specific conditions, in my case, this was on my development machine as part of a company domain. The domain uses a proxy server to manage web requests/responses. It turns out that our proxy server was blocking responses from apiconnector.com hence the exception; In addition to that we had to adjust the proxy settings in Internet Explorer as this provides the default settings in Visual Studio too (when configured correctly).

I cannot specify what was changed in terms of the proxy settings, as I stated, I was helped by a colleague; he managed this part of the resolution; However that only solved half of the problem...the exception was still occurring with Visual Studio, however the addition of the following XML to the web.config file resolved everything, and now it works!

<system.net>
  <defaultProxy enabled="true" useDefaultCredentials="true">
  </defaultProxy>
</system.net>
查看更多
萌系小妹纸
3楼-- · 2019-02-13 14:58

Great I have deleted all the files and replaced with the updated vs2015 published file and it start working.

查看更多
老娘就宠你
4楼-- · 2019-02-13 14:59

In my case, I can't solved with default proxy enabled setting. I solved with this configuration. Don't forget your proxy server port. Reference link

<configuration> 
   <system.net> 
     <defaultProxy> 
        <proxy 
           proxyaddress = "http://proxyserver:80" 
           bypassonlocal = "true" /> 
     </defaultProxy> 
  </system.net> 
</configuration>
查看更多
登录 后发表回答