I have a same problem, i solved the problem just i reconnected my internet connection in my emulator, or you can use device . .
HttpWebRequest throws "The remote server returned an error: NotFound." on VS for Win Phone
-
04-06-2022 - |
Question
I know other people posted the same issue, I read those posts but their solutions didn't work to me :(
I am creating a C# app on Visual Studio Express 2012 for Windows Phone.
The app needs to send a HTTP GET but doesn't seem to work. To test it I cut out all the headers and everything else, and just kept the core code...but still throws me the same exception:
HttpWebRequest webRequest;
webRequest = (HttpWebRequest)WebRequest.Create("http://www.google.com");
webRequest.Method = "GET";
webRequest.BeginGetResponse(new AsyncCallback(GetRequestCallback), webRequest);
and
private void GetRequestCallback(IAsyncResult result)
{
HttpWebResponse response = (result.AsyncState as HttpWebRequest).EndGetResponse(result) as HttpWebResponse;
}
The debug stops inside of GetRequestCallback function throwing:
An unhandled exception of type 'System.Net.WebException' occurred in System.Windows.dll
Additional information: The remote server returned an error: NotFound.
I also looked into the manifest, and these are the capabilities:
<Capabilities>
<Capability Name="ID_CAP_GAMERSERVICES"/>
<Capability Name="ID_CAP_IDENTITY_DEVICE"/>
<Capability Name="ID_CAP_IDENTITY_USER"/>
<Capability Name="ID_CAP_LOCATION"/>
<Capability Name="ID_CAP_MEDIALIB"/>
<Capability Name="ID_CAP_MICROPHONE"/>
<Capability Name="ID_CAP_NETWORKING"/>
<Capability Name="ID_CAP_PHONEDIALER"/>
<Capability Name="ID_CAP_PUSH_NOTIFICATION"/>
<Capability Name="ID_CAP_SENSORS"/>
<Capability Name="ID_CAP_WEBBROWSERCOMPONENT"/>
<Capability Name="ID_CAP_ISV_CAMERA"/>
<Capability Name="ID_CAP_CONTACTS"/>
<Capability Name="ID_CAP_APPOINTMENTS"/>
</Capabilities>
Also, I have been trying with and without Fiddler open but nothing changes. However, when it is open, I can't see any request sent from my machine. It's like if the app really doesn't even access the internet.
Any idea? What am I doing wrong? Should I setup something more on my pc to develop an app that can access the internet, or maybe use a different version of Visual Studio?
Solution