With legacy .NET, you could self-host OWIN via the Microsoft.AspNet.WebApi.OwinSelfHost NuGet package.
Is there a way to self-host OWIN in a .NET Core console app?
With legacy .NET, you could self-host OWIN via the Microsoft.AspNet.WebApi.OwinSelfHost NuGet package.
Is there a way to self-host OWIN in a .NET Core console app?
Yes you can, use the Microsoft.AspNetCore.Owin Package.
Please see https://learn.microsoft.com/en-us/aspnet/core/fundamentals/owin?view=aspnetcore-2.1
As of .Net 6 Preview, the package to load, as mentioned, is still a preview package Microsoft.AspNetCore.Owin
.
It is best to use the example found on the docs Open Web Interface for .NET (OWIN) with ASP.NET Core which references this github package of examples OwinSample.
The sample given is more involved that the original OWIN readme one; but it works.
OWIN basically provides decoupling between the web server and web application.In the case of .NET core you need to use the Microsoft.AspNetCore.Owin package.After you add this nuget you can access the OwinExtensions class which consists of extension methods related to OWIN.One method you could use is UseOwin().These methods are defined in Microsoft.AspNetCore.Owin assembly.
OWIN compatible server such as NOWIN can also host ASP.NET Core applications.