2014-01-07 59 views
2

當我嘗試使用System.Net.Http.HttpClient從具有utf字符的域獲取響應時,出現異常。HttpClient不與國際域名一起工作

The remote name could not be resolved 

有誰知道如何解決這個問題,或者如果有一個圖書館,正確處理?

回答

1

您需要在您的應用中使用enable IDN parsing。配置。它默認關閉。

<configuration> 
    <uri> 
    <idn enabled="All" /> 
    <iriParsing enabled="true" /> 
    </uri> 
</configuration> 
1

我不認爲HttpClient做國際域名解析。

你可以自己實現下面說什麼here

您還可以檢查並當你問什麼鑲邊http://Bücher.ch/

enter image description here

你甚至可以注意到,當你嘗試會發生什麼從URL欄複製/粘貼,它會自動將其轉換爲http://xn--bcher-kva.ch/

+0

謝謝,punycode是一個想法,我可以與:) – Chris