locked
Sevice URI Problem RRS feed

  • Question

  • My service was working fine for several weeks. Now, for whatever reason, I keep getting the error:

         Invalid URI: The hostname could not be parsed.

    Whenever I try to hit the service.  I've changed the URI to various ports, virtual directories, named servers vs. IP addresses.  Nothing seems to work. I've even tried changing it to something like http://google.com.  Every URI it says cannot be parsed.

    ???

    thanks.

    Tuesday, December 20, 2011 6:03 PM

Answers

  • Hi,

    I was able to fix the problem with the addition of one line of code I found on Peter Foot's blog (http://peterfoot.net/PermaLink,guid,5e8c66d2-b86a-4e81-a929-fe2f78b9ba38.aspx).  Here is my code: 

                MyProjectService.MyService serviceClient = new MyProjectService.MyService();
                serviceClient.Url = serviceClient.Url.Replace("localhost", "192.168.2.4");   
                serviceClient.Proxy = System.Net.GlobalProxySelection.GetEmptyWebProxy();  //This is the line I took from Peter's blog
                List<MyService.Products> products = serviceClient.getProducts().ToList();
    
    
    


     I still don't know what caused the problem, as I swear that I didn't change anything. But I'm just happy it's over.  Man, developing for handhelds is painful.

    Aaron


    • Edited by Aaron Edwards Thursday, December 22, 2011 8:20 PM
    • Marked as answer by Jesse Jiang Tuesday, December 27, 2011 2:44 AM
    Thursday, December 22, 2011 8:19 PM

All replies

  • Hello,

     

    Would you please provide some codes about this issue? I guess, something was changed in your codes, you can output some URL information in your service to check which line change the result.

     

    Best regards,

    Jesse


    Jesse Jiang [MSFT]
    MSDN Community Support | Feedback to us
    Thursday, December 22, 2011 8:18 AM
  • Hi,

    I was able to fix the problem with the addition of one line of code I found on Peter Foot's blog (http://peterfoot.net/PermaLink,guid,5e8c66d2-b86a-4e81-a929-fe2f78b9ba38.aspx).  Here is my code: 

                MyProjectService.MyService serviceClient = new MyProjectService.MyService();
                serviceClient.Url = serviceClient.Url.Replace("localhost", "192.168.2.4");   
                serviceClient.Proxy = System.Net.GlobalProxySelection.GetEmptyWebProxy();  //This is the line I took from Peter's blog
                List<MyService.Products> products = serviceClient.getProducts().ToList();
    
    
    


     I still don't know what caused the problem, as I swear that I didn't change anything. But I'm just happy it's over.  Man, developing for handhelds is painful.

    Aaron


    • Edited by Aaron Edwards Thursday, December 22, 2011 8:20 PM
    • Marked as answer by Jesse Jiang Tuesday, December 27, 2011 2:44 AM
    Thursday, December 22, 2011 8:19 PM