这个站点无法从dotnet linux提供安全的asp.net核心连接

问题描述 投票:0回答:2

我目前正在使用asp.net core 2.1开发API。当我在Windows中使用ide visual studio 2019时,我没有运行项目的问题,但现在我使用manjaro linux并使用dotnet控制台进行编译我遇到错误:此站点无法提供安全连接err_ssl_protocol_error

我见过的大多数解决方案都是使用asp.net框架或更改visual studio IDE的选项,所以我无法在我的项目中实现它。我试过添加:

.UseSetting("https_port", "5000")

在program.cs中,但它不起作用

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类

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


}
c# linux asp.net-core
2个回答
1
投票

我正在使用localhost测试实例。我不需要使用https,因此请禁用https。

class program.css

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

class startup.css

//app.UseHsts();

0
投票

我们有一个已知的问题,我们目前正在为在应用服务上的容器中运行的ASP.NET核心应用程序工作。这个问题被描述为here,以及我们的计划,教育社区如何解决今天这个问题以及我们如何计划长期修复它。可能没有关联,但想放在这里以防万一。

© www.soinside.com 2019 - 2024. All rights reserved.