.NET 4.8 Owin ASP.NET SSL/HTTPS

Viewed 35

I have a simple self-hosted OWIN ASP.NET API as seen in the code below.

I need to run this over https. Is it as simple as changing the BaseAddress and installing a self-signed certificate as given here:

https://chavli.com/how-to-configure-owin-self-hosted-website-with-ssl/

If not, what's the simplest way of configuring SSL for this case ?

internal class Program
{
    private static string BaseAddress = "http://localhost:9005/";

    private static void Main(string[] args)
    {
        var app = WebApp.Start<Startup>(url: BaseAddress);
        Console.ReadLine();
    }
}





public class Startup
{
    // This code configures Web API. The Startup class is specified as a type
    // parameter in the WebApp.Start method.
    public void Configuration(IAppBuilder appBuilder)
    {
        // Configure Web API for self-host.
        HttpConfiguration config = new HttpConfiguration();

        config.Routes.MapHttpRoute(
            name: "DefaultApi",
            routeTemplate: "{controller}/",
            defaults: new { id = RouteParameter.Optional }
        );

        appBuilder.UseWebApi(config);
    }
}
0 Answers
Related