나는 다음과 같은 URL에 액세스하는 이상한 문제가 http://xn--fanbys-exa.org/episodes.m4a.rss : 여기HttpWebRequest를 실패 접근
을
void WebRequestButton_Click(object sender, RoutedEventArgs e)
{
string url = "http://xn--fanbys-exa.org/episodes.m4a.rss";
if (Uri.IsWellFormedUriString(url, UriKind.Absolute))
{
HttpWebRequest webRequest = (HttpWebRequest)HttpWebRequest.Create(url);
if (webRequest != null)
{
webRequest.BeginGetResponse(new AsyncCallback(ReadWebRequestCallback), webRequest);
}
}
}
private void ReadWebRequestCallback(IAsyncResult callbackResult)
{
HttpWebRequest request = (HttpWebRequest)callbackResult.AsyncState;
HttpWebResponse response = null;
try
{
response = (HttpWebResponse)request.EndGetResponse(callbackResult);
}
catch (Exception e)
{
System.Diagnostics.Debug.WriteLine(e);
}
if (response != null)
{
using (StreamReader httpwebStreamReader = new StreamReader(response.GetResponseStream()))
{
string results = httpwebStreamReader.ReadToEnd();
System.Diagnostics.Debug.WriteLine(results);
}
response.Close();
}
}
)이이 예외 : 코드입니다 예외 :
A first chance exception of type 'System.ArgumentException' occurred in System.Windows.dll
System.ArgumentException ---> System.ArgumentException: The parameter is incorrect.
at MS.Internal.XcpImports.CheckHResult(UInt32 hr)
at MS.Internal.XcpImports.WebRequest_Send(InternalWebRequest request)
at MS.Internal.InternalWebRequest.Send()
at System.Net.Browser.ClientHttpWebRequest.PrepareAndSendRequest(String method, Uri requestUri, Stream requestBodyStream, WebHeaderCollection headerCollection, CookieContainer cookieContainer)
at System.Net.Browser.ClientHttpWebRequest.BeginGetResponseImplementation()
at System.Net.Browser.ClientHttpWebRequest.InternalBeginGetResponse(AsyncCallback callback, Object state)
at System.Net.Browser.ClientHttpWebRequest.BeginGetResponse(Async'UI Task' (Managed): Loaded 'System.Runtime.Serialization.dll'
지금까지 내가
이 wellformed되는 URL을 말할 수 있습니다.
시도한 모든 브라우저에서 처리 할 수 있습니다.
Fiddler를 테스트하면 Windows Phone 에뮬레이터에서 HTTP 요청을 보내지 않고 있음을 알 수 있습니다.
(활성 피들러 인스턴스) 여러 URL을 시도한 경우
string url = "http://xn--fanbys-exa.org/episodes.m4a.rss";
// not ok --> System.ArgumentException: The parameter is incorrect.
string url = "http://xn--fanbys-exa.org";
// not ok --> System.ArgumentException: The parameter is incorrect.
string url = Uri.EscapeUriString("http://xn--fanbys-exa.org/episodes.m4a.rss");
// not ok --> System.ArgumentException: The parameter is incorrect.
string url = "http://stackoverflow.com";
// ok, HTTP request is sent and response is received
string url = "http://stack--overflow.com";
// ok, HTTP request is sent and response is received
string url = "http://xn--stackoverflow.com";
// ok, HTTP request is sent and response 502 is received
// --> System.Net.WebException: The remote server returned an error: NotFound.
문제는 에뮬레이터 및 장치에서 재생 될 수있다.
내 생각에 DNS와 관련된 것 같습니다.
나는 참조 된 웹 사이트 및 해당 DNS 항목을 제어 할 권한이 없습니다.
아이디어가 있으십니까?
그것을 밖으로 시도하고 그것은 참으로 이상한 일이다 :
수익률 :
은 당연히, 웹 클라이언트도 유사한 문제를 보여줍니다. 코드는 fanboss.org/도메인에있는 URL을 제외한 모든 URL을 사용하여 매력처럼 작동합니다. –