6

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?

ΩmegaMan
  • 29,542
  • 12
  • 100
  • 122
user687554
  • 10,663
  • 25
  • 77
  • 138
  • https://stackoverflow.com/questions/28527257/host-web-api-as-windows-service-using-owin – Joe Sep 26 '18 at 14:01

3 Answers3

1

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

Janus Pienaar
  • 1,083
  • 7
  • 14
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.

ΩmegaMan
  • 29,542
  • 12
  • 100
  • 122
  • FYI to others - the versioning of core.Owin mirrors the .net version it targets. .6x owin targets .net6, 2.x owin targets .net standard 2, etc. – Bill Tarbell Jun 01 '22 at 18:40
0

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.

ashish
  • 2,028
  • 1
  • 10
  • 6