Standalone web API
In the preceding section, we published the ASP.NET Core application as a portable .NET Core application. On any OS (Windows, macOS, or Linux), the preceding portable application will run if the .NET Core runtime is installed.
The portable .NET Core apps run natively even if they are published on any OS. It's achieved by running libuv (a web server for ASP.NET Core apps) natively.
ASP.NET Core can be built as a standalone (self-hosted) application-that is, a published application with a runtime (.NET Core runtime) included with it. As .NET Core (ASP.NET Core) applications are inherently console apps, an executable file is generated when they are published as standalone, and running this file starts the application.
Let's publish PacktContacts
as a standalone application and edit the *.csproj
file to add RuntimeIdentifiers
in the PropertyGroup
section, as shown here:
<PropertyGroup> <TargetFramework>netcoreapp2.0</TargetFramework> <RuntimeIdentifiers...