- Home /
UriFormatException: Invalid URI: Invalid port number for VirtualBox server using IPv6 Address
I've set up a server using a VirtualBox and determined that the address of that server is using IPv6. The address itself is http://[fe80::a00:27ff:fefe:70c5] and I can type that into a browser just fine and see my page. I've tried both of the following codes separately and received the same error both time:
WWW www = new WWW(specURL +
"api/v1/users/1/" + dest + "?access_token=" +
accTok);
yield return www;
UnityWebRequest www = UnityWebRequest.Get(specURL +
"api/v1/users/1/" + dest + "?access_token=" +
accTok);
yield return www.SendWebRequest();
classList.text = www.downloadHandler.text;
where specURL is exactly http://[fe80::a00:27ff:fefe:70c5] and dest and accTok are things specific to the API of the server and shouldn't matter. I've also tried inputting http://[fe80::a00:27ff:fefe:70c5]:80 but that also returns the same error. The full error is this:
UriFormatException: Invalid URI: Invalid port number
System.Uri.Parse (UriKind kind, System.String uriString)
System.Uri.ParseUri (UriKind kind)
System.Uri..ctor (System.String uriString, Boolean dontEscape)
System.Uri..ctor (System.String uriString)
UnityEngineInternal.WebRequestUtils.MakeInitialUrl (System.String targetUrl, System.String localUrl) (at C:/buildslave/unity/build/Modules/UnityWebRequest/Public/WebRequestUtils.cs:527)
UnityEngine.MonoBehaviour:StartCoroutine(IEnumerator)
CanvasHttpsRequest:LookForClasses() (at Assets/CanvasHttpsRequest.cs:72)
UnityEngine.EventSystems.EventSystem:Update()
My assumption is that the formatting of my URI is incorrect, especially in regards to IPv6. Is there anything I'm missing?
Answer by KanraLovesU · Jun 05, 2018 at 11:24 PM
Welp, turns out I missed a slash. Because we were just inputting http://[fe80::a00:27ff:fefe:70c5] I edited the string "api/v1/users/1/" to "/api/v1/users/1/" which would account for the slash between the IP and the API call.
For those wondering it does definitively recognize my server despite it being IPv6 and despite it being on a VirtualBox. I wouldn't expect anything less but good to make sure!
Your answer
Follow this Question
Related Questions
How to upload a file from Android to my own website? 0 Answers
Unable to call external API (IBM Watson) via HTTP request? 1 Answer
Is HttpWebRequest supported for desktop and editor? 2 Answers
Is System.Net.HttpWebRequest supported on Android/iOS 1 Answer
WWW does not show Location in header response (302/Redirect) 1 Answer