Search code examples
visual-studio-2013localhostwindows-8.1winjsintranet

Unable to access localhost from x-ms-webview


I have this code in my WinJS default.html:

<x-ms-webview src="http://localhost/"></x-ms-webview>
<x-ms-webview src="http://display/"></x-ms-webview>
<x-ms-webview src="http://192.168.1.2/"></x-ms-webview>

display is defined in the hosts file:

127.0.0.1 display

and 192.168.1.2 -- the one that is successful -- is another computer on the network.

This is in my appx.manifest:

capabilities

display and localhost successfully load in IE on the desktop and metro.

My OS is Windows 8.1 Enterprise. I have also completely disabled the Windows Firewall and this has had no effect.

What else can I do?


Solution

  • Microsoft blocks connections to the local machine except while running from the Visual Studio debugger.[1]

    There is, however, a workaround tool. Quoting from this post on an MSDN blog:

    Immersive applications (and IE11 on the Desktop) run inside isolated processes known as “AppContainers.” By default, AppContainers are forbidden from sending network traffic to the local computer (loopback).
    [...]
    I have built a GUI tool that allows you to very easily reconfigure an AppContainer to enable loopback traffic. This tool requires Windows 8 and runs on the .NET Framework v4. When launched, the utility scans your computer’s AppContainers and displays them in a list view. Each entry has a checkbox to the left of it, indicating whether the AppContainer may send loopback traffic. You can toggle these checkboxes individually, or use the buttons at the top to set all of the checkboxes at once. Click Save Changes to commit the configuration changes you’ve made, or click Refresh to reload the current configuration settings.

    The aforementioned standalone tool is available from here.