HttpWebRequest throws "Remote server returned error: NotFound." on VS for Win Phone

I know that other people posted the same issue, I read these posts, but their solutions didn't work for me :(

I am creating a C # application in Visual Studio Express 2012 for Windows Phone.

The application should send an HTTP GET, but it does not seem to work. To test this, I cut out all the headers and everything else and just saved the main 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; } 

Debugging stops inside the GetRequestCallback function:

 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 at the manifest, and these are the following features:

 <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> 

In addition, I tried Fiddler with and without an open screen, but nothing changes. However, when it is open, I do not see any request sent from my machine. It looks like the application doesn’t even have access to the Internet.

Any idea? What am I doing wrong? Do I have to configure something else on my computer to develop an application that can access the Internet or possibly use a different version of Visual Studio?

+4
source share
1 answer

I have the same problem, I solved the problem, just connected my internet connection in my emulator, or you can use the device ..

+1
source

Source: https://habr.com/ru/post/1493297/


All Articles