Share via

Visual Studio 2022 localhost https redirection issue on Windows 11 24H2

JoelS 0 Reputation points
2025-09-30T03:32:05.2833333+00:00

Currently running Visual Studio 2022 Professional (version 17.14.36414.22) on Windows 11 24H2 (Build 26100.65.84). When debugging a web application (asp.net [.Net framework], MVC [.Net framework] or Blazor [.NetCore 8]) in VS to http://localhost:, it is redirected to https and MS Edge (version 122.0.2365.106) shows us the below screenshot.

"The connection for this site is not secure. Localhost sent an invalid reponse. ERR_SSL_PROTOCOL_ERROR"

If an affected user logs out and logs back in without breaking VS localhost the following warning is displayed…

"Creation of the virtual directory https:localhost:60668/ failed with the error: Filename: redirection.config Error: Cannot read configuration file. You will need to manually create this virtual directory in IIS Before you can open this project"

We have tried various registry keys, MS Edge Flags, certificates, and Visual Studio settings but no luck yet. Using an older version of VS 2022 is not an option.

I've seen this error in event viewer at the time of it failing too:
.NET Runtime version 4.0.30319.0 - There was a failure initializing profiling API attach infrastructure.  This process will not allow a profiler to attach.  HRESULT: 0x80004005.  Process ID (decimal): 12616.  Message ID: [0x2509].

Developer technologies | ASP.NET | ASP.NET Core

1 answer

Sort by: Most helpful
  1. Anonymous
    2025-09-30T03:50:14.5766667+00:00

    Hi JoelS ,

    I see you've already exhausted the common fixes (registry keys, Edge flags, certificates, VS settings). This issue appears to be specific to the Windows 11 24H2 + VS 2022 v17.14 combination. Here are some advanced solutions that might help:

    Solution 1: Windows 11 24H2 Compatibility Fix The build 26100.65.84 has known issues with localhost SSL handling. Try this Windows-specific fix:

    1. Open PowerShell as Administrator
    2. Run: Get-NetFirewallRule -DisplayName "*IIS*" | Disable-NetFirewallRule
    3. Run: New-NetFirewallRule -DisplayName "IIS Express Allow" -Direction Inbound -Protocol TCP -LocalPort 1024-65535 -Action Allow
    4. Restart and test

    Solution 2: Force HTTP in Project Configuration Since HTTPS redirection is the root cause, override it at the project level:

    1. In your project's .csproj file, add:
    <PropertyGroup>
    <UseSSL>false</UseSSL>
    <SSLPort></SSLPort>
    </PropertyGroup>
    
    1. In Properties\launchSettings.json, ensure all profiles use HTTP only:
    "applicationUrl": "http://localhost:5000"
    

    Solution 3: IIS Express Advanced Reset Your "redirection.config" error suggests deeper IIS Express corruption:

    1. Stop all IIS processes: taskkill /f /im iisexpress.exe
    2. Delete entire folder: %USERPROFILE%\Documents\IISExpress
    3. Run: "%ProgramFiles%\IIS Express\iisexpress.exe" /config:"%ProgramFiles%\IIS Express\config\templates\PersonalWebServer\applicationhost.config"
    4. Let it recreate the user config

    Solution 4: .NET Runtime Profiling Fix The Event Viewer error (HRESULT: 0x80004005) indicates profiling infrastructure failure. This is a Windows 11 24H2 specific issue:

    1. Run Command Prompt as Administrator
    2. Execute: sfc /scannow
    3. Then: DISM /Online /Cleanup-Image /RestoreHealth
    4. Registry fix: Add HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\VSStandardCollectorService150 → DWORD Start = 4 (disabled)

    Solution 5: VS 2022 Workspace Reset Since you can't downgrade VS:

    1. Close VS completely
    2. Delete: %LOCALAPPDATA%\Microsoft\VisualStudio\17.0_*\ComponentModelCache
    3. Delete: %TEMP%\VSLogs
    4. Run VS as Administrator once to regenerate

    Solution 6: Windows 11 24H2 Workaround If all else fails, this forces HTTP debugging:

    1. Install Fiddler Classic or similar proxy
    2. Configure VS to use proxy for localhost
    3. Set proxy to intercept and prevent HTTPS redirects

    The profiling API error suggests Windows Defender or another security tool might be interfering. Try adding VS and your project folders to Windows Defender exclusions.

    Hope this helps!


Your answer

Answers can be marked as 'Accepted' by the question author and 'Recommended' by moderators, which helps users know the answer solved the author's problem.