1
votes

I'm trying to configure https to my Kestrel server to work on Ubuntu 14 with dnxcore50.

But when I add a dependency to:

"Microsoft.AspNet.Server.Kestrel.Https": "1.0.0-rc1-final"

And I try to restore my package I get this message:

Dependency Kestrel.Https 1.0.0-rc1-final does not support framework DNXCore, Version=v5.0

If I go to windows and use dnx451 and add the same dependency things works great.

But, if I can't use Kestrel.Https on Ubuntu with dnxcore50, how can I configure Https on Ubuntu using dnxcore50?

2

2 Answers

1
votes

That's because the HTTPS version of Kestrel only targets the full .NET framework on RC1: https://www.nuget.org/packages/Microsoft.AspNet.Server.Kestrel.Https/1.0.0-rc1-final.

As of RC2 Kestrel.Https will target netstandard1.3: https://github.com/aspnet/KestrelHttpServer/blob/dev/src/Microsoft.AspNetCore.Server.Kestrel.Https/project.json#L20.

So the solution is to either wait for RC2 to drop or use the bleeding RC2 bits from MyGet.

-1
votes

Today Kestrel already supports HTTPS:

Here's the library tha supports it since version 1.0.0:

https://www.nuget.org/packages/Microsoft.AspNetCore.Server.Kestrel.Https/

To implement it on your code, in you main to initialize your asp.net core app add UseHttps as an option

Here's a sample on how to do it!

    public static void Main(string[] args)
    {
        var host = new WebHostBuilder()
            .UseKestrel(options =>
            {
                // options.ThreadCount = 4;
                options.NoDelay = true;
                options.UseHttps("testCert.pfx", "testPassword");
                options.UseConnectionLogging();
            })
            .UseUrls("http://localhost:5000", "https://localhost:5001")
            .UseContentRoot(Directory.GetCurrentDirectory())
            .UseStartup<Startup>()
            .Build();

        // The following section should be used to demo sockets
        //var addresses = application.GetAddresses();
        //addresses.Clear();
        //addresses.Add("http://unix:/tmp/kestrel-test.sock");

        host.Run();
    }

Below there is also a link from the sample

https://github.com/aspnet/KestrelHttpServer/blob/dev/samples/SampleApp/Startup.cs#L37-L43