Mashtani
Mashtani

Reputation: 641

What is the usage of WebApi Selfhosting?

I want to know why we should use Webapi SelfHosted and where it is useful?

Let say we have a console application and selfhosted webapi what is the benefit?

Upvotes: 1

Views: 85

Answers (1)

Markus
Markus

Reputation: 22491

The main benefit is that you do not have to set up IIS and websites when you deploy it. This way, you can simplify the deployment of the service and make it easier for administrators that are not experienced with IIS to install it. Typically, you would not use a Console application for self-hosting an API in a real-world-scenario, but a Windows service that runs whenever the computer is running - without requiring a user to be logged on.

In a less common scenario, you could use a self-hosted Web API for inter-process communication. If you want to exchange data between some processes either on the same or on separate machines, you could host a Web API in the application that provides the data and access it from another one.

Upvotes: 5

Related Questions