Trying to run .net secure app on RPi3 (raspbian linux), getting "Refused to connect" when using https.

The RPi3 is running raspbian OS. I've self-signed certificates, used HTTPs settings in my .net app. On windows 10, the app works great, with and without SSL. On Linux the app works when not using SSL.

I tried the following guides:

Startup.cs:

public void ConfigureServices(IServiceCollection services)
{

    services.Configure<CookiePolicyOptions>(options =>
    {
        // This lambda determines whether user consent for non-essential cookies is needed for a given request.
        options.CheckConsentNeeded = context => true;
        options.MinimumSameSitePolicy = SameSiteMode.None;
    });


    services.AddMvc().SetCompatibilityVersion(CompatibilityVersion.Version_2_1);
        /*.AddRazorPagesOptions(options =>
            options.Conventions.);*/
        services.AddMvc(
            options =>
            {
                options.SslPort = 5001;
                options.Filters.Add(new RequireHttpsAttribute());
            }
        );

        services.AddAntiforgery(
            options =>
            {
                options.Cookie.Name = "_af";
                options.Cookie.HttpOnly = true;
                options.Cookie.SecurePolicy = CookieSecurePolicy.Always;
                options.HeaderName = "X-XSRF-TOKEN";
            }
        );
}

// This method gets called by the runtime. Use this method to configure the HTTP request pipeline.
public void Configure(IApplicationBuilder app, IHostingEnvironment env)
{    
    if (env.IsDevelopment())
    {
        app.UseDeveloperExceptionPage();
    }
    else
    {
        app.UseExceptionHandler("/Home/Error");
        app.UseHsts();  
    }

    app.UseHttpsRedirection();
    app.UseStaticFiles();
    app.UseAuthentication();
    app.UseMvc(routes =>
    {
        routes.MapRoute(
            name: "default",
            template: "{controller=G4}/{action=Index}/{id?}");
    });
}

Program.cs:

public static void Main(string[] args)
{
    CreateWebHostBuilder(args).Build().Run();
}

public static IWebHostBuilder CreateWebHostBuilder(string[] args) =>
    WebHost.CreateDefaultBuilder(args)
        .UseUrls("http://*:5000")
        .UseSetting("https_port", "5001")
        .UseKestrel(options =>
        {
            options.Listen(IPAddress.Loopback, 5000);
            options.Listen(IPAddress.Loopback, 5001,
                listenOptions => { listenOptions.UseHttps("localhost.pfx", "password"); });
        })
        .UseStartup<Startup>();

I expect to run the app on linux with ssl and https, but i get "Refused to connect" error.

0 Answers