Issue connecting to the Internet from UWP

Hi. I’m a developer making Virtual Reality programs with Unity. I’ve been having some issues connecting to an online database when building for UWP so it can work with Windows Mixed Reality. Basically, what I’m trying to do is pull questions from an online JSON database which will the user will answer. However, with UWP we have issues pulling questions from the server. No other format, be it Oculus or OpenVR (which is compatible with WMR) has this issue. Does UWP have a certain issue with connecting to the Internet or interpreting JSON files?

Have you enabled the internet servers in the publishing settings?

Any updates on this? I’m having kind of a related problem where I’m getting some text from a server using UnityWebRequest. It works properly in Unity, however when running the program on HoloLens, it won’t connect.

1 Like

Hi,
with Unity 2017.3.1p1 I use UnityWebRequest setting chunkedTransfer to false and checking only the error property.
Doing so It works even in Release build, otherwise it works only in debug buid.

1 Like

Hey, thank you for your reply! I just tried your solution and it worked. I am curious though about why (isNetworkError || isHttpError) is triggered in release build?

Hi everyone,
are there any updates on this topic?
Because I am using Unity version 2018.3.0f2 and I have a similar problem with UnityWebRequest that I can’t get solved right now.

My setup:
I want to release my application for the HoloLens and use UnityWebRequest to retrieve data from a database. In Unity there is no problem compiling and I can read the data as expected. But when I release the application in debug mode in Visual Studio for the HoloLens I get the following errors:

error = Unknown Error
Response Code = 0```

What I've been trying to do so far:
```chunkedTransfer = false
(in Unity) Edit > Project Settings > Player Settings > Capabilities
- Internet client, 
- Internet Client Server and 
- Private Network Client Server ```

I have an internet connection with the HoloLens, because if I disconnect the device I get the error message "cannot resolve destination host".

Any help in this area is very appreciated.

For anyone dealing with the same issue:
I can release my app on the HoloLens now, since I downgraded my Unity version to 2018.1.0f2. Then I could reproduce the error message that says “cannot resolve destination host” and I noticed a strange behavior: in Unity an http request can be sent if no “/” is set after the url, but on the HoloLens it does not work without the slash.

having pretty much the same problem. Unity 2018.3.7f1

in player settings > capabilities i have:
enterprise authentication
internet client
internetclientserver
privatenetworkclientserver
all enabled.

tried https://server.name/filename.json - works in editor, not on hololens (was working with http:// file hosted on private network with the above settings)
https://server.name/filename.json/ (additional / on the end) hasn’t resolved the issue and now causes errors in the editor (unexpected character while parsing path)

changing https:// to http:// works within the editor, not within the HoloLens.

tears hair out
sets HoloLens on fire

looks like it may have been a Microsoft problem, as after a software+firmware update to my dev HoloLens, it all started working.

so for anyone else having issues loading public files to your HoloLens, make sure you’ve installed the latest updates before you set it on fire.

I am facing the same problem.

It works totally fine in Editor but not on Hololens. I have set all the capabilities but still I get the error “Cannot connect to destination host”

Any other solution?

I have the same problem. Does anyone know a solution for this?

Update your Unity version. This has been fixed in 2020.1.0a4, 2019.3.0b4, 2019.2.7f2 and 2018.4.10f1.

I am having the same issues using UnityWebRequest on a HoloLens 2. I get the error of “Cannot resolve destination host”. Was using Unity 2018.4.12 which was recommended by MS. Had upgraded to 2018.4.15, same problem. So, I need to downgrade to Unity 2018.4.10f1 to possibly fix this problem? So it looks like Unity developers did not merge in this fix with later releases so the UnityWebRequest problem continues with later releases within the 2018.4 branch?

No, you don’t need to downgrade. “Cannot resolve destination host” is a different problem. Is that URL reachable from HoloLens via Edge? Have you enabled internet client capability in your manifest?

The URL is reachable from the HoloLens via Edge (downloading a obj file, the text was displayed). I had enabled internet client capability through the Publishing Settings.

Can you check if the manifest in the generated VS project has that capability enabled?

The manifest.json file under Packages does not have a internet capability listed. Does have com.unity.modules.unitywebrequest listed though. What would be the statement for adding internet capability directly to the manifest file?

Not the manifest file under Packages folder. I meant the AppX manifest file generated by Unity when you build to UWP (it’s called package.appxmanifest I believe).

Unity 2018.4.10f.1 Build → AppxManifest.xml
[I need to add the internet connection script and test to verify if this version works, I will update this thread once I verify]

============

Unity 2018.4.12f1 Build → AppxManifest.xml
[Internet connection on the Hololens2 fails]

Unity does not overwrite existing manifest. If you build on top of the previous build, capability player settings will not take effect.