Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

asp.net web api self hosting / owin / katana

There are multiple question I have around self-hosting

Self Hosting Nuget

There are 2 nuget which provide self hosting : Microsoft.AspNet.WebApi.OwinSelfHost and Microsoft.AspNet.WebApi.SelfHost, so does microsoft have 2 implementation of self hosting?? or they are same??

Owin or Kitana

the name of nuget is Microsoft.AspNet.WebApi.OwinSelfHost has OWIN, but as far as I read Owin is an interface and Kitana an implementation, what is the name of the nuget for implementation??

Hosting in Production

I have managed to run the example by creating a console. But when deploying to prod, how to deploy?? Run the exe and keep running console, cant do that. what if somebody closes that console. So should be hosted as part of windows service?? or Is there any other way?

like image 616
harishr Avatar asked Nov 12 '14 08:11

harishr


People also ask

Can ASP Net Web API ability to both self hosting?

ASP.NET Web API can be either be hosted in IIS or in a separate host process. The former approach is usually appropriate when the Web API is part of a web application and one or more web applications are going to consume it.

Can ASP.NET Core Web API be self hosted?

This tutorial shows how to host a web API inside a console application. ASP.NET Web API does not require IIS. You can self-host a web API in your own host process. New applications should use OWIN to self-host Web API.

What is OWIN and Katana?

OWIN is a community-owned specification, not an implementation. The Katana project is a set of open-source OWIN components developed by Microsoft. For a general overview of both OWIN and Katana, see An Overview of Project Katana.

What is OWIN self hosting?

Open Web Interface for . NET (OWIN) defines an abstraction between . NET web servers and web applications. OWIN decouples the web application from the server, which makes OWIN ideal for self-hosting a web application in your own process, outside of IIS.


2 Answers

after working on months with webapi/owin I got answers to above questions..

The package to use

Microsoft.AspNet.WebApi.OwinSelfHost

and for hosting better to use topshelf

Topshelf

please read this blog post

like image 104
harishr Avatar answered Sep 18 '22 06:09

harishr


NuGet package here clearly states this.

Microsoft ASP.NET Web API 2.2 Self Host 5.2.2 This is a legacy package for hosting ASP.NET Web API within your own process (outside of IIS). Please use the Microsoft.AspNet.WebApi.OwinSelfHost package for new projects.

Anyways, SelfHost is old and is based on WCF stack. OwinSelfHost is new and is based on Katana (name is Katana and not Kitana, BTW).

For production hosting, console app is not practical. You will need to create a Windows service. Take a look at this.

like image 37
Badri Avatar answered Sep 21 '22 06:09

Badri