question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

`dotnet try` doesn't work, due to invalid ssl certificate

See original GitHub issue

The 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:

  1. Changing the url to http instead of https, which didn’t work, because it seems that the server is not listening to http.

  2. Executing dotnet try --help to find a commandline switch to change that behavior, but there is only a switch for the port and the uri 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

image image

Please complete the following:

  • OS
    • Windows 10
    • macOS
    • Linux (Please specify distro)
    • iOS
    • Android
  • Browser
    • Chrome
    • Firefox
    • Edge
    • Safari

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:6 (3 by maintainers)

github_iconTop GitHub Comments

5reactions
colombodcommented, Nov 15, 2019

you can register development certificates by doing the following dotnet dev-certs https --trust

0reactions
anitconsultantllccommented, Jan 11, 2020

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:

  1. Cleaning up ONLY the “localhost” certs in my certificate manager by going to… image

image

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, Action1 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](IHttpApplication1 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.`

Read more comments on GitHub >

github_iconTop Results From Across the Web

bypass invalid SSL certificate in .net core - Stack Overflow
I faced off the same problem when working with self-signed certs and client cert auth on .NET Core 2.2 and Docker Linux containers....
Read more >
10 Ways to Fix the NET::ERR_CERT_DATE_INVALID Error
The NET::ERR_CERT_DATE_INVALID error occurs when browsers don't trust the reliability of a site's SSL certificate. Here's how to fix it.
Read more >
How to Fix the NET::ERR_CERT_INVALID Error?
Changing the Date and Time on Windows is pretty easy, and you can follow the below steps. Press Windows key > Select Settings...
Read more >
ERR_CERT_COMMON_NAME_I...
However, an error message like NET::ERR_CERT_COMMON_NAME_INVALID may appear because of a wrong Secure Sockets Layer (SSL) certificate or browser ...
Read more >
FIX: Certificate error when you try to visit an SSL Web site by ...
If you choose to ignore this error and continue, do not enter private information into the website. For more information, see "Certificate Errors"...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found