Simple hosting of a .NET Core Web API Service (Similar to NodeJs) - asp.net-core

I have a .Net Nuget Package that works on a .NET Core Web API Service when it is proxied by my API Management Server. I would like to setup some automated testing of this service to be run when I run my builds.
Normally, when I want to run a service to be seen from other computers, I host it in IIS. But I would rather not have to have IIS up and running on my build servers.
I am wondering, is there a simple way to host a .Net Core Web API Service that can just run in-memory? (Similar to the way NodeJs can be run) I understand that Kestrel is used under the hood for ASP.NET Core. Maybe it be setup to do that?
NOTE: Because this will be proxied by my API Management Server, it need to be accessible by other servers on my network. (Not just localhost.)

Kestrel is the simplest way you can use to achieve, you can config kestrel to enable it listening to remote request, see this document

Related

What is the need of external server in ASP.NET Core outprocess hosting?

In OutOfProcess hosting model, there are 2 web servers i.e. one internal web server and one external web server. The internal web server is called Kestrel and the external web server can be IIS, Apache, or Nginx.
When Kestrel is the cross-platform web server for the ASP.NET Core application, and support request from all platforms, then what is the use of external web server?
The IIS or apache contains a lot of advanced feature. For example, advanced logging, GUI ,failed request trancing and other feature. It is very easy to configure and find the logs more easily.
The Kestrel need all settings by the codes and if you need special feature, you need to develop by yourself or changing the codes.

Host Asp.net Core Web Api locally

I am learning Asp.net Core Web Api. I need to access the api from a flutter application but am not ready to host the api on Azure. What are my options if I want to host the api locally on my computer so I can access it from another application like my Flutter app client, and is there any tutorials I can follow to learn how to implement the solution.
There are several ways to go about this, here are some options:
FROM VISUAL STUDIO: You can simply run the ASP.NET Core Web API from Visual Studio in Development Mode by Pressing F5
FROM COMMAND PROMPT: Run the API Project from the command line by opening a command prompt window in the root project folder of the project and use the dotnet run command. See here for more info about the command: dotner run command
HOSTING IN IIS: I am assuming you are running a windows OS. You can turn on IIS and its features. Simply follow the instructions on this page: Host ASP.NET Core in IIS on how to deploy ASP.NET Core to IIS. The advantage of this is that you have the application always running while you work on your flutter application locally.
I hope this helps you resolve your situation.
What are my options if I want to host the api locally on my computer so I can access it from another application like my Flutter app client, and is there any tutorials I can follow to learn how to implement the solution.
If your application is developing now, there is no need to host the application and let the Flutter app client to access. We could build some json file as the right format like web api response to develop the client app.
If your client application and web api has now developed successfully, you want to host the web api to let fluent app or other application to access from internet. You should have a public IP address and host the application on IIS or else. Public IP address you should ask for the IP provider company. Without a public address, the client side app couldn't access your application from internet.
If your web api and the client app are in the same intranet, you could let the client app directly access the web api after the web api hosted on IIS by using hosting server's IP address.
About how to host the asp.net core application on IIS, you could refer to this article.

How to run asp.net core application is work with all web server? Is that reason Kestrel?

I don't understand actually . How to asp.net core application be cross platform?
Is that reason kestrel? I think web server take request and send to Kestrel bla bla. Why them need to Kestrel?
How to asp.net core application be cross platform?
It's common that an application needs a runtime. Java, JS, Python, … you always need something on the target system to make your app work. For asp.net core it's the asp.net core runtime and this runtime is available for many platforms. That's why you can run your app on all of these platforms. See https://dotnet.microsoft.com/download/dotnet-core/2.2 for available packages.
Is that reason kestrel?
Kestrel is the web server part. (If you write a command line app, you don't need kestrel). You can compare it with e.g. Tomcat in Java.
I think web server take request and send to Kestrel bla bla.
In most situations (except very small setups) we always have a proxy (web) server that takes the request and forwards it to another web server. While both seem to be very similar they have different roles.
Common (but just an example) setup:
Proxy (web) server: Terminate TLS, load balance to multiple backend web servers.
Backend (web) server: Run the application. But focus on this part. No TLS certs to configure, easy to scale,...
Why them need to Kestrel?
Again while some languages / frameworks use modules for existing servers (e.g. PHP) others use separate servers (Java, JS, C#, …). For c# it's the kestrel web host.

WebHost.CreateDefaultBuilder when hosting without IIS on Windows

I'm planning to host Asp.Net Core 2 application without IIS on Windows.
The default way to create web host seems to be using WebHost.CreateDefaultBuilder. But what is confusing me is that inside there is a call to the method UseIISIntegration.
Is it ok to use WebHost.CreateDefaultBuilder when hosting Asp.Net Core 2 app without IIS on Windows? Or other options are advisable?
Its absolutely fine to use WebHost.CreateDefaultBuilder
As when hosting with IIS it just work as proxy and redirect request to kestrel server.
It doesn't create much of problem.
Take a look at this article here

Can ASP.NET vNext with .NET core be hosted outside of IIS?

For Mono, it is explicit that ASP.NET can be hosted outside IIS on Apache or Nginx
Since the 1.0.0 release is nearby, I was looking at the publishing aspects of open source ASP.NET vNext.
Can ASP.NET vNext be hosted outside of IIS on a *nix server such as Ubuntu?
Yes, ASP.NET Core can be hosted at linux.
Have you tried this documentation, in which helps to install in Ubuntu 14.04?
AspNet Core has its own web server called Kestrel. Anytime you run an Asp.Net Core web app you run it using this server. IIS or Nginx are used as reverse proxies you can use when you want to expose your app in the wild (they can handle authentication etc.). During development you can just Kestrel directly without have to set up IIS or Nginx.
I dont know if it is working with Nginx, but Apache Server has a module called mod_asp which is a bridging component to the .NET runtime. Maybe that one is worth a try.