`dotnet try` doesn't work, due to invalid ssl certificate
See original GitHub issueThe Problem
When executing dotnet try demo
the webserver is started and the browser is launched, but no website is shown because the connection is marked as not secure, due to it being server over https without a valid certificate.
What I tried to solve the problem:
-
Changing the url to http instead of https, which didn’t work, because it seems that the server is not listening to http.
-
Executing
dotnet try --help
to find a commandline switch to change that behavior, but there is only a switch for the port and theuri
parameter throws an exception when called with the uri where it should host. Taking a look at the exception, it seems to me that the parameter uri triggers a WebRequest - maybe it wants to retrieve a file instead of host the webserver with the--uri
parameter?
What do I need to do to host that thing over http?
Did this error occur while using dotnet try
or online?
-
dotnet-try
- .NET Jupyter Notebook
- online
What kind of error was it?
- User Interface (UI): For example the output never displayed
- Service Error: For example “The service is temporarily unavailable. We are working on it”
- Other:
Screenshots
Please complete the following:
- OS
- Windows 10
- macOS
- Linux (Please specify distro)
- iOS
- Android
- Browser
- Chrome
- Firefox
- Edge
- Safari
Issue Analytics
- State:
- Created 4 years ago
- Comments:6 (3 by maintainers)
Top GitHub Comments
you can register development certificates by doing the following
dotnet dev-certs https --trust
Got a similar issue today detailed by @8. I actually got a “System.InvalidOperationException” due to not having a trusted self-signed cert but I actually had many certs for “localhost” already on my Windows 10 Enterprise machine (10+ or more). I resolved this by doing the following:
and removing all the “localhost” certificates. 2. Generate the certificate:
dotnet dev-certs https
3. Trust the certificate:dotnet dev-certs https -t
4. Run “dotnet try demo” again from an Administrativor Developer Command Prompt for 2019 and it started right up in Chrome Version 79.0.3945.117 (Official Build) (64-bit) with no issues.####---------------------- My Console Output ----------------------------------####
D:\repos\try-samples\csharp8>dotnet try Unhandled exception: System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation. ---> System.InvalidOperationException: Unable to configure HTTPS endpoint. No server certificate was specified, and the default developer certificate could not be found or is out of date. To generate a developer certificate run 'dotnet dev-certs https'. To trust the certificate (Windows and macOS only) run 'dotnet dev-certs https --trust'. For more information on configuring HTTPS see https://go.microsoft.com/fwlink/?linkid=848054. at Microsoft.AspNetCore.Hosting.ListenOptionsHttpsExtensions.UseHttps(ListenOptions listenOptions, Action
1 configureOptions) at Microsoft.AspNetCore.Hosting.ListenOptionsHttpsExtensions.UseHttps(ListenOptions listenOptions) at Microsoft.AspNetCore.Server.Kestrel.Core.Internal.AddressBinder.AddressesStrategy.BindAsync(AddressBindContext context) at Microsoft.AspNetCore.Server.Kestrel.Core.Internal.AddressBinder.BindAsync(IServerAddressesFeature addresses, KestrelServerOptions serverOptions, ILogger logger, Func2 createBinding) at Microsoft.AspNetCore.Server.Kestrel.Core.KestrelServer.StartAsync[TContext](IHttpApplication
1 application, CancellationToken cancellationToken) at Microsoft.AspNetCore.Hosting.WebHost.StartAsync(CancellationToken cancellationToken) at Microsoft.AspNetCore.Hosting.WebHostExtensions.RunAsync(IWebHost host, CancellationToken token, String startupMessage) at Microsoft.AspNetCore.Hosting.WebHostExtensions.RunAsync(IWebHost host, CancellationToken token, String startupMessage) at Microsoft.AspNetCore.Hosting.WebHostExtensions.RunAsync(IWebHost host, CancellationToken token) at Microsoft.AspNetCore.Hosting.WebHostExtensions.Run(IWebHost host) at MLS.Agent.CommandLine.CommandLineParser.<>c.<Create>b__6_0(StartupOptions startupOptions, InvocationContext invocationContext) in F:\workspace_work\1\s\MLS.Agent\CommandLine\CommandLineParser.cs:line 72 at MLS.Agent.CommandLine.CommandLineParser.<>c__DisplayClass6_0.<Create>b__16(InvocationContext context, StartupOptions options) in F:\workspace_work\1\s\MLS.Agent\CommandLine\CommandLineParser.cs:line 256 — End of inner exception stack trace — at System.RuntimeMethodHandle.InvokeMethod(Object target, Object[] arguments, Signature sig, Boolean constructor, Boolean wrapExceptions) at System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture) at System.Delegate.DynamicInvokeImpl(Object[] args) at System.Delegate.DynamicInvoke(Object[] args) at System.CommandLine.Invocation.ModelBindingCommandHandler.InvokeAsync(InvocationContext context) at System.CommandLine.Invocation.InvocationPipeline.<>c__DisplayClass4_0.<<BuildInvocationChain>b__0>d.MoveNext() — End of stack trace from previous location where exception was thrown — at MLS.Agent.CommandLine.CommandLineParser.<>c__DisplayClass6_0.<<Create>b__5>d.MoveNext() in F:\workspace_work\1\s\MLS.Agent\CommandLine\CommandLineParser.cs:line 153 — End of stack trace from previous location where exception was thrown — at System.CommandLine.Invocation.InvocationExtensions.<>c.<<UseParseErrorReporting>b__22_0>d.MoveNext() — End of stack trace from previous location where exception was thrown — at System.CommandLine.Invocation.InvocationExtensions.<>c__DisplayClass8_0.<<UseTypoCorrections>b__0>d.MoveNext() — End of stack trace from previous location where exception was thrown — at System.CommandLine.Invocation.InvocationExtensions.<>c.<<UseSuggestDirective>b__7_0>d.MoveNext() — End of stack trace from previous location where exception was thrown — at System.CommandLine.Invocation.InvocationExtensions.<>c.<<UseParseDirective>b__6_0>d.MoveNext() — End of stack trace from previous location where exception was thrown — at System.CommandLine.Invocation.InvocationExtensions.<>c.<<UseHelp>b__20_0>d.MoveNext() — End of stack trace from previous location where exception was thrown — at System.CommandLine.Builder.CommandLineBuilderExtensions.<>c__DisplayClass4_0.<<UseVersionOption>b__0>d.MoveNext() — End of stack trace from previous location where exception was thrown — at System.CommandLine.Invocation.InvocationExtensions.<>c.<<RegisterWithDotnetSuggest>b__23_0>d.MoveNext() — End of stack trace from previous location where exception was thrown — at System.CommandLine.Invocation.InvocationExtensions.<>c__DisplayClass5_0.<<UseExceptionHandler>b__0>d.MoveNext()D:\repos\try-samples\csharp8>dotnet dev-certs https The HTTPS developer certificate was generated successfully.
D:\repos\try-samples\csharp8>dotnet dev-certs https -t Trusting the HTTPS development certificate was requested. A confirmation prompt will be displayed if the certificate was not previously trusted. Click yes on the prompt to trust the certificate. A valid HTTPS certificate is already present.
D:\dotnettry>dotnet try demo Hosting environment: Production Content root path: C:\Users\Owner.dotnet\tools.store\dotnet-try\1.0.19620.2\dotnet-try\1.0.19620.2\tools\netcoreapp3.0\any Now listening on: https://localhost:54978 Application started. Press Ctrl+C to shut down.`