aspire: [WebToolsE2E][Aspire] With the dev cert not trusted, when running Aspire app with https, the dashboard page fails to load with the browser dev tools showing: Error starting gRPC call. HttpRequestException: The SSL connection could not be established, see inner exception. AuthenticationException
REGRESSION INFO: https is a new feature on Aspire 8.0 P5
INSTALL STEPS
- Clean machine: Win11 x64 23h2 ENU
- Install the SDK 8.0.300-preview.24164.23
- Install Aspire.ProjectTemplates.8.0.0-preview.5.24164.9
- Apply nuget dotnet8 feed
REPRO STEPS
- Open cmd, run following code to create an aspire / aspire-starter app and run with https
dotnet new aspire-starter -o AspireSta cd AspireSta/AspireSta.AppHost dotnet run -lp https - Go to https://localhost:xxxx
Note
- Running with http works fine.
Workaround
- Run
dotnet dev-certs https --trust(Windows and macOS only ) to trust the certificate, then run it again with https, it works fine. - But this workaround only supports windows/mac, not linux.
ACTUAL The exception only shows up in the browser F12 tool and not in the console output.
Error: Grpc.Core.RpcException: Status(StatusCode=“Internal”, Detail=“Error starting gRPC call. HttpRequestException: The SSL connection could not be established, see inner exception. AuthenticationException: The remote certificate is invalid because of errors in the certificate chain: UntrustedRoot”, DebugException=“System.Net.Http.HttpRequestException: The SSL connection could not be established, see inner exception.”)
—> System.Net.Http.HttpRequestException: The SSL connection could not be established, see inner exception.
—> System.Security.Authentication.AuthenticationException: The remote certificate is invalid because of errors in the certificate chain: UntrustedRoot
at System.Net.Security.SslStream.CompleteHandshake(SslAuthenticationOptions sslAuthenticationOptions)
at System.Net.Security.SslStream.ForceAuthenticationAsync[TIOAdapter](Boolean receiveFirst, Byte[] reAuthenticationData, CancellationToken cancellationToken)
at System.Net.Http.ConnectHelper.EstablishSslConnectionAsync(SslClientAuthenticationOptions sslOptions, HttpRequestMessage request, Boolean async, Stream stream, CancellationToken cancellationToken)
— End of inner exception stack trace —
at System.Net.Http.ConnectHelper.EstablishSslConnectionAsync(SslClientAuthenticationOptions sslOptions, HttpRequestMessage request, Boolean async, Stream stream, CancellationToken cancellationToken)
at System.Net.Http.HttpConnectionPool.ConnectAsync(HttpRequestMessage request, Boolean async, CancellationToken cancellationToken)
at System.Net.Http.HttpConnectionPool.AddHttp2ConnectionAsync(QueueItem queueItem)
at System.Threading.Tasks.TaskCompletionSourceWithCancellation
1.WaitWithCancellationAsync(CancellationToken cancellationToken) at System.Net.Http.HttpConnectionPool.SendWithVersionDetectionAndRetryAsync(HttpRequestMessage request, Boolean async, Boolean doRequestAuth, CancellationToken cancellationToken) at System.Net.Http.DiagnosticsHandler.SendAsyncCore(HttpRequestMessage request, Boolean async, CancellationToken cancellationToken) at System.Net.Http.RedirectHandler.SendAsync(HttpRequestMessage request, Boolean async, CancellationToken cancellationToken) at Grpc.Net.Client.Balancer.Internal.BalancerHttpHandler.SendAsync(HttpRequestMessage request, CancellationToken cancellationToken) at Grpc.Net.Client.Internal.GrpcCall2.RunCall(HttpRequestMessage request, Nullable1 timeout) --- End of inner exception stack trace --- at Grpc.Net.Client.Internal.Retry.RetryCall2.StartRetry(Action1 startCallFunc) at Grpc.Net.Client.Internal.Retry.RetryCallBase2.GetResponseCoreAsync()
at Aspire.Dashboard.Model.DashboardClient.<>c__DisplayClass25_0.<<EnsureInitialized>g__ConnectAsync|2>d.MoveNext() in //src/Aspire.Dashboard/Model/DashboardClient.cs:line 164
— End of stack trace from previous location —
at Aspire.Dashboard.Components.ApplicationName.OnInitializedAsync() in //src/Aspire.Dashboard/Components/Controls/ApplicationName.razor.cs:line 32
at Microsoft.AspNetCore.Components.ComponentBase.RunInitAndSetParametersAsync()
at Microsoft.AspNetCore.Components.RenderTree.Renderer.GetErrorHandledTask(Task taskToHandle, ComponentState owningComponentState)
EXPECTED
About this issue
- Original URL
- State: closed
- Created 3 years ago
- Comments: 28 (24 by maintainers)
Long, long ago I was prototyping some code to create and install a developer certificate on Linux. I just did some work to package it as a global tool and support Debian based distro (except for a Ubuntu browser issue). You can find it here: https://github.com/tmds/linux-dev-certs.
@amcasey 👀
If you run into this issue on a Linux system (where
dev-certs https --trustis not supported), you can usehttpinstead ofhttps:The security impact of this is limited because the services bind to
localhost, and only someone with sufficient privileges on the system to capture interface packets will now be able to see unencrypted packages instead of encrypted ones.Updated title so that this issue is easier to find. With https profile now being the default for Aspire Apps in Aspire 8.0 Preview 5, we now get this warning when we do
dotnet run. This is expected.Workaround: As described in the warning, you can trust the dev certificate by running the command
dotnet dev-certs https --trustto fix this problem.Thanks @amcasey! I opened https://github.com/dotnet/aspire/issues/3262 to track doing this work.
We suppressed that because we wanted to tightly control what was being output to the console. For example if you raise it to warning you get this in the output: