简体   繁体   中英

Self Hosting OWIN in .NET Core

With legacy .NET, you could self-host OWIN via the Microsoft.AspNet.WebApi.OwinSelfHost NuGet package . My question is, is there a way to self-host OWIN in a .NET Core console app? I haven't been able to find anything.

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.

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM