Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. Mobile Development
  3. Mobile
  4. Invalid URI: The hostname could not be parsed

Invalid URI: The hostname could not be parsed

Scheduled Pinned Locked Moved Mobile
helpsysadmindebugginglearning
3 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • B Offline
    B Offline
    biop codeproject
    wrote on last edited by
    #1

    Hi all, I have a web service. My coworker provides that to me. It is in the internal network. I have a PDA program (in Windows Mobile 6) which use the web service. Originally it works fine. I can debug the program in VS2008. One day as we have to test, my coworker and I move to a separate network. His machine IP changes and so does my machine. After changing, I then cannot run my program in debug mode. It always give this message:

    Quote:

    Invalid URI: The hostname could not be parsed

    And it stops at GetResponse statement in the following code:

    Public Shared Function CheckURLConnection(ByVal strUrl As String, ByVal networkCredential As NetworkCredential, ByRef strMsg As String) As Boolean

    Dim streamReader As StreamReader
    Dim webResponse As WebResponse = Nothing
    Dim streamResponse As Stream
    Dim webRequest As WebRequest

    Dim isSucceed As Boolean = False
    Try
    webRequest = webRequest.Create(strUrl)
    webRequest.Credentials = networkCredential
    webRequest.Timeout = 60000
    webResponse = webRequest.GetResponse
    streamResponse = webResponse.GetResponseStream
    ^^^^^^^^^^^^^^^^^
    streamReader = New StreamReader(streamResponse)

    And if I run the program without debugging, there is no problem. There is no stopping at webResponse.GetResponseStream! Strange. Please help. {Edited} The URL is this format: http://10.25.0.52/tems\_rfid/TEMS\_RFID\_WebService.asmx Of course, I have validated independently I can access using IE! So the URI, in theory, can be parsed. {Edited 2} If I create a new PDA program and put the CheckURLConnection() in there, no problem!

    A 1 Reply Last reply
    0
    • B biop codeproject

      Hi all, I have a web service. My coworker provides that to me. It is in the internal network. I have a PDA program (in Windows Mobile 6) which use the web service. Originally it works fine. I can debug the program in VS2008. One day as we have to test, my coworker and I move to a separate network. His machine IP changes and so does my machine. After changing, I then cannot run my program in debug mode. It always give this message:

      Quote:

      Invalid URI: The hostname could not be parsed

      And it stops at GetResponse statement in the following code:

      Public Shared Function CheckURLConnection(ByVal strUrl As String, ByVal networkCredential As NetworkCredential, ByRef strMsg As String) As Boolean

      Dim streamReader As StreamReader
      Dim webResponse As WebResponse = Nothing
      Dim streamResponse As Stream
      Dim webRequest As WebRequest

      Dim isSucceed As Boolean = False
      Try
      webRequest = webRequest.Create(strUrl)
      webRequest.Credentials = networkCredential
      webRequest.Timeout = 60000
      webResponse = webRequest.GetResponse
      streamResponse = webResponse.GetResponseStream
      ^^^^^^^^^^^^^^^^^
      streamReader = New StreamReader(streamResponse)

      And if I run the program without debugging, there is no problem. There is no stopping at webResponse.GetResponseStream! Strange. Please help. {Edited} The URL is this format: http://10.25.0.52/tems\_rfid/TEMS\_RFID\_WebService.asmx Of course, I have validated independently I can access using IE! So the URI, in theory, can be parsed. {Edited 2} If I create a new PDA program and put the CheckURLConnection() in there, no problem!

      A Offline
      A Offline
      Aditya_Pandey
      wrote on last edited by
      #2

      Try to keep the URL in between inverted commas "URL" .

      B 1 Reply Last reply
      0
      • A Aditya_Pandey

        Try to keep the URL in between inverted commas "URL" .

        B Offline
        B Offline
        biop codeproject
        wrote on last edited by
        #3

        But how would that help me? At first, I run the program in debug mode in my original network. URL at that time is this: http://10.25.0.52/tems\_rfid/TEMS\_RFID\_WebService.asmx And it works! Later on we have to test out at another network segment. Instead of getting IP address using DHCP, we assign IP address to each device. We also set up the Subnet mask and Default gateway.) Of course that includes my own laptop, my coworker's network (which hosts the web service) and the mobile device. As the IP of the machine hosting the web service changes, I need to update the URL to something like: http://192.168.0.20/tems\_rfid/tems\_RFID\_WebService.asmx Afterward, I cannot debug run the program. If I just run the program, there is no problem. Any thoughts?

        1 Reply Last reply
        0
        Reply
        • Reply as topic
        Log in to reply
        • Oldest to Newest
        • Newest to Oldest
        • Most Votes


        • Login

        • Don't have an account? Register

        • Login or register to search.
        • First post
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • World
        • Users
        • Groups