'This site can’t provide a secure connection asp.net core from dotnet linux

I am currently developing an API using asp.net core 2.1. When I use the ide visual studio 2019 in windows I don't have problems running the project, but now I am using manjaro linux and I compile by using dotnet console I have a error: This site can’t provide a secure connection err_ssl_protocol_error

enter image description here

Most of the solutions I've seen are made using the framework asp.net or changing options the visual studio IDE, so I can not implement it in my project. I have tried adding:

.UseSetting("https_port", "5000")

inside program.cs but it didn't work

class program.cs

public static void Main(string[] args)
{
    var host = CreateWebHostBuilder(args).Build();
    RunSeeding(host);//esta llamando el alimentador de la base de datos
    host.Run();
}

private static void RunSeeding(IWebHost host)
{
    var scopeFactory = host.Services.GetService<IServiceScopeFactory>();
    using (var scope = scopeFactory.CreateScope())
    {
        var seeder = scope.ServiceProvider.GetService<SeedDb>();
        seeder.SeedAsync().Wait();
    }
}

public static IWebHostBuilder CreateWebHostBuilder(string[] args) =>
    WebHost.CreateDefaultBuilder(args)
        .UseSetting("https_port", "5000")
        .UseStartup<Startup>();

configure.cs class

 public void Configure(IApplicationBuilder app, IHostingEnvironment env)
{
    if (env.IsDevelopment())
    {
        app.UseDeveloperExceptionPage();
    }
    else
    {
        // The default HSTS value is 30 days. You may want to change this for production scenarios, see https://aka.ms/aspnetcore-hsts.
        app.UseHsts();
    }

    app.UseHttpsRedirection();
    app.UseMvc();                


    app.UseCors("AllowSpecificOrigin");


}


Solution 1:[1]

I was able to fix this on my asp.net core project by:

  1. Open the project properties by right-clicking the project from the solution explorer and selecting properties
  2. Open the Debug tab
  3. Under "Web Server Settings", check "Enable SSL"

Now when I debug the application it automatically launches to the https URL.

Solution 2:[2]

We have a known issue on which we're working currently for ASP.NET Core apps running in containers on app service. This issue is described here, as well as our plan to educate the community on how to work around this issue today and on how we plan on repairing it long-term. May not be related but wanted to drop it in here just in case.

Solution 3:[3]

I'm working a localhost testing instance. I don't need to work with https so disable https.

class program.css

//.UseSetting("https_port", "5000")

class startup.css

//app.UseHsts();

Solution 4:[4]

I am most likely late to the party but perhaps this might help someone else who will visit. You can say the error is almost self explanatory, you are trying to reach the site using a non supported protocol. Please make sure you are using the correct protocol i.e if your site is http then make sure the url typed on the browser is indeed http, example https://localhost:8000 vs http://localhost:8000, note the letter s difference in the URLs. I ran into such issues and changing to the correct protocol solved my problem.

Solution 5:[5]

In ASP.net Core 6, go to:

Project --> <> Properties --> Debug --> General --> Open debug launch profiles UL --> IIS Express --> untick the Use SSL option.

Clean --> Recompile --> Publish

Make sure your using http and not https

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Softerware
Solution 2 brady gaster
Solution 3 Jhon Alexander Jimenez Morales
Solution 4
Solution 5 Fandango68