問題描述
正如標(biāo)題所示,我從 ASP.NET 頁面得到以下異常
As the title suggests, I'm getting the following exception from an ASP.NET page
無法解析遠(yuǎn)程名稱:'apiconnector.com'
The remote name could not be resolved: 'apiconnector.com'
但是我可以從瀏覽器導(dǎo)航到這個(gè)地址,所以我知道它是可以訪問的.
I can however navigate to this address from a browser, so I know it's accessible.
為什么 ASP.NET 不能導(dǎo)航到這個(gè)地址?
Why can't ASP.NET navigate to this address?
我如何準(zhǔn)確地導(dǎo)航"?
好的,基本上我已經(jīng)導(dǎo)入了一個(gè) WSDL 作為服務(wù)參考.我所做的只是從服務(wù)引用中調(diào)用方法.它是執(zhí)行實(shí)際導(dǎo)航的服務(wù)引用.
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.
服務(wù)參考配置包含以下 XML
Service reference configuration contains the following XML
<endpoints>
<endpoint ... address="http://apiconnector.com/API.asmx" ... />
</endpoints>
推薦答案
在一位同事的幫助下,我終于設(shè)法完成了這項(xiàng)工作.該問題僅在特定條件下發(fā)生,就我而言,這是在我的開發(fā)機(jī)器上作為公司域的一部分.該域使用代理服務(wù)器來管理 Web 請(qǐng)求/響應(yīng).事實(shí)證明,我們的代理服務(wù)器正在阻止來自 apiconnector.com 的響應(yīng)因此出現(xiàn)異常;除此之外,我們還必須調(diào)整 Internet Explorer 中的代理設(shè)置,因?yàn)檫@也提供了 Visual Studio 中的默認(rèn)設(shè)置(如果配置正確).
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).
我無法具體說明代理設(shè)置發(fā)生了什么變化,正如我所說,我得到了一位同事的幫助;他管理了決議的這一部分;然而,這只解決了一半的問題...... Visual Studio 仍然出現(xiàn)異常,但是將以下 XML 添加到 web.config 文件解決了所有問題,現(xiàn)在它可以工作了!
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>
這篇關(guān)于ASP.NET 異常:無法解析遠(yuǎn)程名稱:“apiconnector.com"的文章就介紹到這了,希望我們推薦的答案對(duì)大家有所幫助,也希望大家多多支持html5模板網(wǎng)!