Closed segnew closed 1 month ago
Hey @danroth27 have you seen this error before? Any idea how to troubleshoot? Error: The connection for this site is not secure, locahost sent an invalid response, ERR_SSL_PROTOCOL_ERROR
@segnew Typically when you run the app using the .NET CLI the app will run over HTTP, not HTTPS. So, I'm not sure why you're getting an HTTPS address at all when running the app using dotnet watch
. Could you please share the console output with us and the contents of the launchSettings.json in the failing project?
dotnet watch š„ Hot reload enabled. For a list of supported edits, see https://aka.ms/dotnet/hot-reload. š” Press "Ctrl + R" to restart. dotnet watch š§ Building... Determining projects to restore... All projects are up-to-date for restore. BlazorApp -> C:\Users\sidne\BlazorApp\bin\Debug\net8.0\BlazorApp.dll dotnet watch š Started info: Microsoft.Hosting.Lifetime[14] Now listening on: http://localhost:5156 info: Microsoft.Hosting.Lifetime[0] Application started. Press Ctrl+C to shut down. info: Microsoft.Hosting.Lifetime[0] Hosting environment: Development info: Microsoft.Hosting.Lifetime[0] Content root path: C:\Users\sidne\BlazorApp dotnet watch š Shutdown requested. Press Ctrl+C again to force exit. info: Microsoft.Hosting.Lifetime[0] Application is shutting down...
{ "$schema": "http://json.schemastore.org/launchsettings.json", "iisSettings": { "windowsAuthentication": false, "anonymousAuthentication": true, "iisExpress": { "applicationUrl": "http://localhost:9731", "sslPort": 44365 } }, "profiles": { "http": { "commandName": "Project", "dotnetRunMessages": true, "launchBrowser": true, "applicationUrl": "http://localhost:5156", "environmentVariables": { "ASPNETCORE_ENVIRONMENT": "Development" } }, "https": { "commandName": "Project", "dotnetRunMessages": true, "launchBrowser": true, "applicationUrl": "https://localhost:7289;http://localhost:5156", "environmentVariables": { "ASPNETCORE_ENVIRONMENT": "Development" } }, "IIS Express": { "commandName": "IISExpress", "launchBrowser": true, "environmentVariables": { "ASPNETCORE_ENVIRONMENT": "Development" } } } }
Thanks @segnew. That output says that the app is listening at http://localhost:5156/, which is an http address not an https address. If you browse to the http address, do you still get an error? Typically, when you run dotnet watch
it should launch the browser at the correct address for you.
I determined the issue was caused by an automatic redirect of localhost in Chrome which is my default browser. When I manually set http instead of https it still redirected. In Edge, it redirected but if I manually specified http it did not redirect.
To correct the problem, I accessed: chrome://net-internals/#hsts and deleted domain security policies for localhost.
Thanks for your assistance.
Interesting. Thanks for letting us know! I do wonder how you ended up with HSTS for localhost. ASP.NET Core apps are typically set up with HSTS, but only when the site isn't running in the Development environment.
@blowdart @adityamandaleeka FYI.
URL
https://dotnet.microsoft.com/en-us/learn/aspnet/blazor-cli-tutorial/run https://localhost:5156
Operating system
windows
More information about your system
Windows 11 X64
Description
I installed the SDK to allow me to work with ASP.NET Core from the command line. I started the blazor-cli-tutorial to make sure everything was working. "dotnet watch" fails in both Edge and Chrome with: The connection for this site is not secure, locahost sent an invalid response, ERR_SSL_PROTOCOL_ERROR
I have two computers which use Bitdefender Total Security and Malwarebytes for protection. The command line interface works on one but not the other. The only known difference is that the computer with the error message has Visual Studio 17.11.3 installed.
I have no problem running the Blazor application in visual studio but it is using: https://localhost:7186/ The cli is using: https://localhost:5156/
I tried disabling both Bitdefender and Malwarebytes but the problem remained. What can I do?
dotnet --info
.NET SDK: Version: 8.0.401 Commit: 811edcc344 Workload version: 8.0.400-manifests.6c274a57 MSBuild version: 17.11.4+37eb419ad
Runtime Environment: OS Name: Windows OS Version: 10.0.22631 OS Platform: Windows RID: win-x64 Base Path: C:\Program Files\dotnet\sdk\8.0.401\
.NET workloads installed: Configured to use loose manifests when installing new manifests. [aspire] Installation Source: VS 17.11.35303.130 Manifest Version: 8.1.0/8.0.100 Manifest Path: C:\Program Files\dotnet\sdk-manifests\8.0.100\microsoft.net.sdk.aspire\8.1.0\WorkloadManifest.json Install Type: FileBased
[maui-windows] Installation Source: VS 17.11.35303.130 Manifest Version: 8.0.72/8.0.100 Manifest Path: C:\Program Files\dotnet\sdk-manifests\8.0.100\microsoft.net.sdk.maui\8.0.72\WorkloadManifest.json Install Type: FileBased
[maccatalyst] Installation Source: VS 17.11.35303.130 Manifest Version: 17.5.8030/8.0.100 Manifest Path: C:\Program Files\dotnet\sdk-manifests\8.0.100\microsoft.net.sdk.maccatalyst\17.5.8030\WorkloadManifest.json Install Type: FileBased
[ios] Installation Source: VS 17.11.35303.130 Manifest Version: 17.5.8030/8.0.100 Manifest Path: C:\Program Files\dotnet\sdk-manifests\8.0.100\microsoft.net.sdk.ios\17.5.8030\WorkloadManifest.json Install Type: FileBased
[android] Installation Source: VS 17.11.35303.130 Manifest Version: 34.0.113/8.0.100 Manifest Path: C:\Program Files\dotnet\sdk-manifests\8.0.100\microsoft.net.sdk.android\34.0.113\WorkloadManifest.json Install Type: FileBased
Host: Version: 8.0.8 Architecture: x64 Commit: 08338fcaa5
.NET SDKs installed: 8.0.304 [C:\Program Files\dotnet\sdk] 8.0.400 [C:\Program Files\dotnet\sdk] 8.0.401 [C:\Program Files\dotnet\sdk]
.NET runtimes installed: Microsoft.AspNetCore.App 6.0.33 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App] Microsoft.AspNetCore.App 7.0.20 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App] Microsoft.AspNetCore.App 8.0.8 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App] Microsoft.NETCore.App 6.0.33 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App] Microsoft.NETCore.App 7.0.20 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App] Microsoft.NETCore.App 8.0.8 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App] Microsoft.WindowsDesktop.App 6.0.33 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App] Microsoft.WindowsDesktop.App 7.0.20 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App] Microsoft.WindowsDesktop.App 8.0.8 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]
Other architectures found: x86 [C:\Program Files (x86)\dotnet] registered at [HKLM\SOFTWARE\dotnet\Setup\InstalledVersions\x86\InstallLocation]
Environment variables: Not set
global.json file: Not found
Learn more: https://aka.ms/dotnet/info
Download .NET: https://aka.ms/dotnet/download