Dependent on Microsoft Documentation:
https://docs.microsoft.com/en-us/aspnet/core/fundamentals/servers/?view=aspnetcore-2.0&tabs=aspnetcore2x
Kestrel can be used by itself or with a reverse proxy server, such as IIS, Nginx, or Apache. A reverse proxy server receives HTTP requests from the Internet and forwards them to Kestrel after some preliminary handling.
IIS, Nginx, and Apache can't be used without Kestrel or a custom server implementation. ASP.NET Core was designed to run in its own process so that it can behave consistently across platforms.
But when i run the visual studio 2017, always IIS Express runs. So how to depend on kestrel alone if that is possible dependent on MS documentation.
You can change the startup application from the toolbar in VS2017
![](https://www.manongdao.com/static/images/pcload.jpg)
In the example above Visual Studio will host my app in IIS Express (the item with the tick). If you want to run it as a Kestrel hosted application then I would select WebApplication2
from the drop down. Now, when I start the application it will run from a command prompt window.
If you are using .NET Core 2.0 then your Program.cs
file should look something like this:
public class Program
{
public static void Main(string[] args)
{
BuildWebHost(args).Run();
}
public static IWebHost BuildWebHost(string[] args) =>
WebHost.CreateDefaultBuilder(args)
.UseStartup<Startup>()
.Build();
}
}
Behind the scenes (in the Build()
method) ASP.NET Core will add the calls to ensure you app will run within IIS and Kestrel without you needing to change anything.