Invalid URI: The hostname could not be parsed
-
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 WebRequestDim 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!
-
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 WebRequestDim 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!
Try to keep the URL in between inverted commas "URL" .
-
Try to keep the URL in between inverted commas "URL" .
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?