Home >Backend Development >C++ >How to Fix net_http_client_execution_error in UWP Apps Accessing Localhost?

How to Fix net_http_client_execution_error in UWP Apps Accessing Localhost?

Mary-Kate Olsen
Mary-Kate OlsenOriginal
2025-01-11 11:21:42972browse

How to Fix net_http_client_execution_error in UWP Apps Accessing Localhost?

Resolving net_http_client_execution_error in UWP Apps Accessing Localhost

The Issue:

UWP applications, after deployment via .appxbundle, may encounter a net_http_client_execution_error when attempting to access localhost (127.0.0.1), typically a local database. This error doesn't manifest during Visual Studio debugging. The root cause is Windows' default restriction on localhost access for UWP apps.

The Fix:

Microsoft's checknetisolation.exe utility allows granting loopback exceptions. Here's how to enable it:

  1. Open a command prompt (cmd.exe).
  2. Navigate to the checknetisolation.exe directory (usually C:WindowsSystem32).
  3. Execute the following command, replacing <package family name> with your app's package family name:
<code>checknetisolation loopbackexempt -a -n=<package family name></code>
  1. Verify the exemption using:
<code>checknetisolation loopbackexempt -l</code>

Important Considerations:

  • Locate your app's package family name within Visual Studio's Package.appxmanifest (Packaging tab) or using PowerShell's Get-AppxPackage cmdlet.
  • If the exemption becomes ineffective, clear all existing exemptions:
<code>checknetisolation loopbackexempt -c</code>
  • Then, re-apply the exemption individually for your application.
  • For comprehensive information, consult Microsoft's documentation: https://www.php.cn/link/10a9288f519d683f87f6443f7b6810e6 (Note: This link may be outdated. Search for "UWP Localhost Access" on the Microsoft Docs website for the most up-to-date information).

The above is the detailed content of How to Fix net_http_client_execution_error in UWP Apps Accessing 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