问题描述
正如标题所示,我从 ASP.NET 页面得到以下异常
As the title suggests, I'm getting the following exception from an ASP.NET page
无法解析远程名称:'apiconnector.com'
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.
为什么 ASP.NET 不能导航到这个地址?
Why can't ASP.NET navigate to this address?
我如何准确地导航"?
好的,基本上我已经导入了一个 WSDL 作为服务参考.我所做的只是从服务引用中调用方法.它是执行实际导航的服务引用.
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.
服务参考配置包含以下 XML
Service reference configuration contains the following XML
<endpoints>
<endpoint ... address="http://apiconnector.com/API.asmx" ... />
</endpoints>
推荐答案
在一位同事的帮助下,我终于设法完成了这项工作.该问题仅在特定条件下发生,就我而言,这是在我的开发机器上作为公司域的一部分.该域使用代理服务器来管理 Web 请求/响应.事实证明,我们的代理服务器正在阻止来自 apiconnector.com 的响应因此出现异常;除此之外,我们还必须调整 Internet Explorer 中的代理设置,因为这也提供了 Visual Studio 中的默认设置(如果配置正确).
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).
我无法具体说明代理设置发生了什么变化,正如我所说,我得到了一位同事的帮助;他管理了决议的这一部分;然而,这只解决了一半的问题...... Visual Studio 仍然出现异常,但是将以下 XML 添加到 web.config 文件解决了所有问题,现在它可以工作了!
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>
这篇关于ASP.NET 异常:无法解析远程名称:“apiconnector.com"的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!