0

I'm trying to configure my AspNetCore application to use TLS. However, when I run the application, I get the following error:

Secure Connection Failed

An error occurred during a connection to localhost:54321. SSL received a record that exceeded the maximum permissible length. Error code: SSL_ERROR_RX_RECORD_TOO_LONG

So far, I have selected "Enable SSL" in the project properties. I've also added:

public void ConfigureServices(IServiceCollection services)
{
    services.Configure<MvcOptions>(options =>
    {
        options.Filters.Add(new RequireHttpsAttribute());
    });

And:

public void Configure(IApplicationBuilder app, IHostingEnvironment env)
{
  RewriteOptions options = new RewriteOptions()
       .AddRedirectToHttps();
    app.UseRewriter(options);

I'm hosting this under IIS Express. My guess is that this is caused because I haven't specified a certificate; but all the articles I can find on this assume use of Kestrel.

Any help would be appreciated.

  • https://www.ssl.com/how-to/fix-browser-error-ssl_error_rx_record_too_long-or-internet-explorer-cannot-display-the-webpage-on-linux/ is this the issue? – Mocolicious Mar 21 '18 at 16:58
  • 1
    Did you enable SSL inside your project properties > debug? – Jason Roner Mar 21 '18 at 18:47
  • You cannot specify a certificate in VS. It was handled automatically by IIS Express installer and VS, and they choose a suitable port and the default certificate. If needed, add the solution as a new server in Jexus Manager, and then you can review SSL settings, https://www.jexusmanager.com/en/latest/tutorials/ssl-diagnostics.html – Lex Li Mar 21 '18 at 19:36
  • Seem there is the same question https://stackoverflow.com/questions/46618360/asp-net-core-2-develop-using-custom-domain-names-and-ssl-using-iisexpress?utm_medium=organic&utm_source=google_rich_qa&utm_campaign=google_rich_qa – Kim C Mar 22 '18 at 08:34
  • @Mocolicious that seems to relate to Linux, but I tried 443 ("sslPort": 443), but it just says it can't connect at all –  Mar 22 '18 at 10:22
  • @JasonRoner yes - Enable SSL is checked –  Mar 22 '18 at 10:23

0 Answers0