locked
"An error occurred while sending the request." error while trying to read a uri

    Question

  • Hi,

    I work on reading a xml from a uri by following code

     

    Uri uri = new Uri(String.Format("http://xxxxxxxxxx/Documents/xxxxxxxxx.xml"));                HttpClient client = new HttpClient();                HttpResponseMessage response = await client.GetAsync(uri);                response.EnsureSuccessStatusCode();                Stream stream = await response.Content.ReadAsStreamAsync();                XDocument xdoc = XDocument.Load(stream);

    I throws an exception in the below line:

    HttpResponseMessage response = await client.GetAsync(uri);

    The exception Message is :

    "An error occurred while sending the request."

    Inner Exception:  

    {"Unable to connect to the remote server"}

    InnerException = {"An attempt was made to access a socket in a way forbidden by its access permissions 10.10.100.77:80"}

    Please provide a solutions for this issue



    Thursday, May 23, 2013 11:23 AM

Answers

  • I believe this is a capabilities issue. 

    Matt Small - Microsoft Escalation Engineer - Forum Moderator
    If my reply answers your question, please mark this post as answered.

    NOTE: If I ask for code, please provide something that I can drop directly into a project and run (including XAML), or an actual application project. I'm trying to help a lot of people, so I don't have time to figure out weird snippets with undefined objects and unknown namespaces.

    Thursday, May 23, 2013 1:59 PM
    Moderator

All replies

  • I believe this is a capabilities issue. 

    Matt Small - Microsoft Escalation Engineer - Forum Moderator
    If my reply answers your question, please mark this post as answered.

    NOTE: If I ask for code, please provide something that I can drop directly into a project and run (including XAML), or an actual application project. I'm trying to help a lot of people, so I don't have time to figure out weird snippets with undefined objects and unknown namespaces.

    Thursday, May 23, 2013 1:59 PM
    Moderator
  • What does that mean? I am having the same issue when I debug with Visual studio but not in a surface computer
    Wednesday, March 12, 2014 7:03 PM