C# ASP.NET 异常:无法解析远程名称:'apiconnector.com'
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/18077946/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
ASP.NET Exception: The remote name could not be resolved: 'apiconnector.com'
提问by Matthew Layton
As the title suggests, I'm getting the following exception from an ASP.NET page
正如标题所暗示的,我从 ASP.NET 页面收到以下异常
The remote name could not be resolved: 'apiconnector.com'
无法解析远程名称:'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?
为什么 ASP.NET 不能导航到这个地址?
EDIT: How am I "navigating" exactly?
编辑:我究竟如何“导航”?
Ok so basically I've imported a WSDLas 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.
好的,基本上我已经导入了一个WSDL作为服务引用。我所做的只是从服务引用中调用方法。执行实际导航的是服务引用。
Service reference configuration contains the following XML
服务引用配置包含以下 XML
<endpoints>
<endpoint ... address="http://apiconnector.com/API.asmx" ... />
</endpoints>
采纳答案by Matthew Layton
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).
在一位同事的帮助下,我终于设法使这项工作顺利进行。该问题仅在特定条件下发生,就我而言,这是在我的开发机器上作为公司域的一部分。该域使用代理服务器来管理 Web 请求/响应。事实证明,我们的代理服务器阻止了来自 apiconnector.com 的响应,因此出现了异常;除此之外,我们还必须调整 Internet Explorer 中的代理设置,因为这也提供了 Visual Studio 中的默认设置(如果配置正确)。
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!
我无法指定代理设置方面发生了什么变化,正如我所说,我得到了一位同事的帮助;他管理了这部分决议;然而,这只解决了问题的一半……Visual Studio 仍然出现异常,但是将以下 XML 添加到 web.config 文件解决了所有问题,现在它可以工作了!
<system.net>
<defaultProxy enabled="true" useDefaultCredentials="true">
</defaultProxy>
</system.net>
回答by vijay sahu
Great I have deleted all the files and replaced with the updated vs2015 published file and it start working.
太好了,我已经删除了所有文件并替换为更新的 vs2015 发布文件,它开始工作了。
回答by B M
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>