Witam. Otrzymuję error ERR_SSL_PROTOCOL_ERROR, kiedy używam przekierowań http do https. Kiedy wejdę do Debug properties > zaznaczę Enable SSL nie otrzymuję erroru kiedy wejdę na http, ale przekierowanie nie działa i strona w ogóle się nie ładuje. Tak wygląda Startup.cs:
using Microsoft.AspNetCore.Builder;
using Microsoft.AspNetCore.Hosting;
using Microsoft.EntityFrameworkCore;
using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Hosting;
using SecurityAPI.Models;
using System;
namespace SecurityAPI
{
public class Startup
{
private readonly IConfiguration Configuration;
public Startup(IConfiguration configuration)
{
Configuration = configuration;
}
// This method gets called by the runtime. Use this method to add services to the container.
// For more information on how to configure your application, visit https://go.microsoft.com/fwlink/?LinkID=398940
public void ConfigureServices(IServiceCollection services)
{
services.AddControllers();
services.AddHttpsRedirection(p =>
{
p.HttpsPort = 58352;
});
services.AddDbContext<AppDbContext>(cfg =>
{
cfg.UseSqlServer(Configuration.GetConnectionString("Default"));
});
}
// This method gets called by the runtime. Use this method to configure the HTTP request pipeline.
public void Configure(IApplicationBuilder app, IWebHostEnvironment env)
{
if (env.IsDevelopment())
{
app.UseDeveloperExceptionPage();
}
else
{
app.UseDeveloperExceptionPage();
}
app.UseStaticFiles();
app.UseHttpsRedirection();
app.UseRouting();
app.UseEndpoints(endpoints =>
{
endpoints.MapControllers();
});
}
}
}
A tak Program.cs:
using Microsoft.AspNetCore.Hosting;
using Microsoft.Extensions.Hosting;
using System.Security.Authentication;
namespace SecurityAPI
{
public class Program
{
public static void Main(string[] args)
{
CreateHostBuilder(args).Build().Run();
}
public static IHostBuilder CreateHostBuilder(string[] args) =>
Host.CreateDefaultBuilder(args)
.ConfigureWebHostDefaults(webBuilder =>
{
webBuilder.UseStartup<Startup>();
webBuilder.ConfigureKestrel(options =>
{
options.ConfigureHttpsDefaults(p =>
{
p.SslProtocols = SslProtocols.Tls13;
});
});
});
}
}
Czym to może być spowodowane, i jak to naprawić? Dzięki za pomoc.