Home >Backend Development >C++ >How Do I Fix 'net_http_client_execution_error' When My UWP App Accesses localhost?

How Do I Fix 'net_http_client_execution_error' When My UWP App Accesses localhost?

Barbara Streisand
Barbara StreisandOriginal
2025-01-11 11:49:44543browse

How Do I Fix

Troubleshooting Network Loopback Restrictions in UWP Apps

Problem:

UWP applications attempting to connect to a local CouchDB instance (or similar local server) on "localhost" (127.0.0.1) may fail with a "net_http_client_execution_error".

Cause:

Windows' default security settings restrict UWP apps from accessing localhost to enhance network security.

Resolution:

To permit localhost access for your UWP application, follow these steps:

  1. Find Your Package Family Name: Locate your UWP app's package family name. You can find this using Visual Studio 2015's Package.appxmanifest editor or the PowerShell command Get-AppxPackage. The name will have a format like "MyPackage_edj12ye0wwgwa".

  2. Grant Loopback Access: Open an elevated command prompt (run as administrator) and execute this command, replacing <package family name> with your app's actual package family name:

<code>c:\>checknetisolation loopbackexempt -a -n=<package family name></code>
  1. (Optional) Revoke Loopback Access: To remove the loopback exemption, use this command in an elevated command prompt:
<code>c:\>checknetisolation loopbackexempt -d -n=<package family name></code>
  1. Reset Loopback Exemptions (if needed): If loopback exemptions become unreliable, clear all exemptions and reapply them individually using:
<code>c:\>checknetisolation loopbackexempt -c</code>

Important Considerations:

The above is the detailed content of How Do I Fix 'net_http_client_execution_error' When My UWP App Accesses localhost?. For more information, please follow other related articles on the PHP Chinese website!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn