воскресенье, 5 апреля 2020 г.

OWIN in ASP.NET Core? ASP.NET Core vs selfhost ASP.NET

https://docs.microsoft.com/ru-ru/aspnet/core/fundamentals/owin?view=aspnetcore-3.1



Yes. In fact, all ASP.NET Core applications are self-hosted. Even in production, IIS/Nginx/Apache are a reverse proxy for the self-hosted application.
In a reasonably standard Program.cs class, you can see the self-hosting. The IISIntegration is optional - it's only necessary if you want to integrate with IIS.
public class Program
{
    public static void Main(string[] args)
    {
        var config = new ConfigurationBuilder()
            .AddCommandLine(args)
            .AddEnvironmentVariables(prefix: "ASPNETCORE_")
            .Build();

        var host = new WebHostBuilder()
            .UseConfiguration(config)
            .UseKestrel()
            .UseContentRoot(Directory.GetCurrentDirectory())
            .UseIISIntegration()
            .UseStartup<Startup>()
            .Build();

        host.Run();
    }
}

https://stackoverflow.com/questions/35997873/migrating-from-owin-to-asp-net-core

  • Middleware is quite similar between Katana and Core but you use HttpContext instead of IOwinContext.
  • Startup.cs is similar but there's much more DI support.
  • WebApi has been merged into MVC
  • DelegatingHandler is gone, use middleware instead.
  • HttpConfiguration has been split up into Routing and MvcOptions.

Комментариев нет:

Отправить комментарий