简体   繁体   中英

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 do.net console I have a error: This site can't provide a secure connection err_ssl_protocol_error

在此处输入图像描述

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");


}

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

在此处输入图片说明

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");


}

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

在此处输入图片说明

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");


}

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

在此处输入图片说明

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");


}

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

在此处输入图片说明

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");


}

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

I am using vs Code. .net version 6. Removing below line from launchSettings.json worked for me

"sslPort": 44308 <-- Remove this.

I run the project with

do.net run --urls "http://localhost:5100"

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM