AspNetCoreSharedServer.Api 2.0.5

dotnet add package AspNetCoreSharedServer.Api --version 2.0.5
                    
NuGet\Install-Package AspNetCoreSharedServer.Api -Version 2.0.5
                    
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="AspNetCoreSharedServer.Api" Version="2.0.5" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="AspNetCoreSharedServer.Api" Version="2.0.5" />
                    
Directory.Packages.props
<PackageReference Include="AspNetCoreSharedServer.Api" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add AspNetCoreSharedServer.Api --version 2.0.5
                    
#r "nuget: AspNetCoreSharedServer.Api, 2.0.5"
                    
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package AspNetCoreSharedServer.Api@2.0.5
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=AspNetCoreSharedServer.Api&version=2.0.5
                    
Install as a Cake Addin
#tool nuget:?package=AspNetCoreSharedServer.Api&version=2.0.5
                    
Install as a Cake Tool

AspNetCoreSharedServer

A ASP.NET Core server for Linux that starts Kestrel on demand and stops it when idle. For use when hosting ASP.NET Core in a shared hosting environment behind a proxy like Apache or Nginx, where Kestrel should not run as a permanent Systemd service using resources, but should be started on demand and shutdown when idle.

Usage

First install AspNetCoreSharedServer using the comman sudo dotnet tool install AspNetCoreSharedServer --global. Next, execute aspnet-server install to install the server as a service. This works on Linux using Systemd or OpenRC (like on Alpine) and on macOS. You can then manage the service with your system's service commands and the name aspnet-server. To uninstall the system service run aspnet-server uninstall. To show help on usage, execute aspnet-server -? or aspnet-server -help.

Configure AspNetCoreSharedServer

All the configuration is stored in /etc/aspnet-server/configuration.json a and in json files named after the application name in /etc/aspnet-server. When the configuration is changed, changes are applied on the fly. The configuration.json file is defined as follows:

{
  "IdleTimeout": 300,
  "Recycle": 1200,
  "Disbled": false,
  "User": "www-data",
  "Group": "www-data"
  "FailureLimit": 5,
  "FailureInterval": "00:05:00",
  "Syslog": {
    "Host": "localhost",
    "Port": 514,
    "Protocol": "Udp"
  },
  "Command": "None",

  "Applications": [
    {
      "Name": "MyApp",
      "Assembly": "/Path/To/ASPNETCoreApp.dll",
      "Arguments": "",
      "Urls": "http://original-domain.org",
      "ListenUrls": "http://localhost:10000",
      "Environment": {
        "ASPNETCORE_ENVIRONMENT": "Production"
      }
      "IdleTimeout": 300,
      "Recycle": 1200,
      "Disabled": false,
      "User": "www-data",
      "Group": "www-data",
      "Status": "Running"
    }, 
    ... more applications can be defined here ...
  ]
}
  • Name specifies the name of the application. It must be unique.
  • Assembly denotes the path to the ASP.NET Core application DLL.
  • Arguments are optional command line arguments passed to the application.
  • Urls is the original URL that the application will respond to. This are the urls as received by the proxy server.
  • ListenUrls are the URLs that this Application will listen on. This is where the proxy server will forward requests to. You can omit the port in this urls and AspNetCoreSharedServer will automatically assign a port.
  • IdleTimeout is the time in seconds or JSON time value after which the application will be stopped when it is idle.
  • Recycle is the time in seconds or JSON time value after which the application will be restarted, regardless of activity.
  • Environment is a dictionary of environment variables that will be set for the application when it is started.
  • Disable if true, the application or the server is disabled.
  • Syslog optional Syslog configuration.
  • FailureLimit number of failures within FailureInterval in order to disable app pool.
  • FailureInterval time span within to count the number of failures.

The individual applications can also be placed in separate json files, named after the applications name like so:

{
    "Name": "MyApp",
    "Assembly": "/Path/To/ASPNETCoreApp.dll",
    "Arguments": "",
    "Urls": "http://original-domain.org",
    "ListenUrls": "http://localhost:10000",
    "Environment": {
    "ASPNETCORE_ENVIRONMENT": "Production"
    }
    "IdleTimeout": 300,
    "Recycle": 1200,
    "Disabled": false,
    "User": "www-data",
    "Group": "www-data",
    "Status": "Running"
} 

This would be placed in /etc/aspnet-server/MyApp.json. Note that aspnet-server install sets the permissions of /etc/aspnet-server to user only access and the owner & group of /etc/aspnet-server to root & www-data. That means that only root can create applications. If you want all users of group www-data to be able to create applications, change access to /etc/aspnet-server to user & group write and execute.

After you have defined your applications in the configuration.json file, you can proxy to the sockets specified in ListenUrls from Apache or Nginx. The original Urls that Apache or Nginx serve will be passed to Kestrel as a environment varibale ORIGINAL_URLS from the Urls parameter in configuration.json.

You can also manage the configuration.json file programmatically by using AspNetCoreSharedServer.Api: Import AspNetCoreSharedServer.Api via nuget to your project.

using AspNetCoreSharedServer;
...
var app = new Application()
{
	Name = "Name of the ASP.NET Core application",
	Assembly = "Startup Assembly",
	Arguments = "Startup Arguments",
	Environment = new Dictionary<string, string>()
	{
        { "ASPNETCORE_ENVIRONMENT", "Production" }
	},
	ListenUrls = "http://localhost:10000",
	Urls = "http://original-domain.org",
};
AspServer.Configuration.Update(app);
or
AspServer.Configuration.Add(app);
or
AspServer.Configuration.Remove(app);
or
AspServer.Configuration.Remove("App Name");

Or to lookup an application:

using AspNetCoreSharedServer;
...
AspServer.Configuration.Load();
var app = AspServer.Configuration.Applications["Name of Application"];
...

To find a free IP port:

var port = AspServer.FindFreePort();

If you do non atomic stuff with AspServer.Configuration, you must enclose it in a mutex lock, so always only one process can modify configuration.json:

using (var mutex = AspServer.Mutex) {
    AspServer.Configuration.Load();

    code that manupulates AspServer.Configuration ...
    
    AspServer.Configuration.Save();
}
Product Compatible and additional computed target framework versions.
.NET net5.0 was computed.  net5.0-windows was computed.  net6.0 was computed.  net6.0-android was computed.  net6.0-ios was computed.  net6.0-maccatalyst was computed.  net6.0-macos was computed.  net6.0-tvos was computed.  net6.0-windows was computed.  net7.0 was computed.  net7.0-android was computed.  net7.0-ios was computed.  net7.0-maccatalyst was computed.  net7.0-macos was computed.  net7.0-tvos was computed.  net7.0-windows was computed.  net8.0 was computed.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed.  net9.0 was computed.  net9.0-android was computed.  net9.0-browser was computed.  net9.0-ios was computed.  net9.0-maccatalyst was computed.  net9.0-macos was computed.  net9.0-tvos was computed.  net9.0-windows was computed.  net10.0 was computed.  net10.0-android was computed.  net10.0-browser was computed.  net10.0-ios was computed.  net10.0-maccatalyst was computed.  net10.0-macos was computed.  net10.0-tvos was computed.  net10.0-windows was computed. 
.NET Core netcoreapp2.0 was computed.  netcoreapp2.1 was computed.  netcoreapp2.2 was computed.  netcoreapp3.0 was computed.  netcoreapp3.1 was computed. 
.NET Standard netstandard2.0 is compatible.  netstandard2.1 was computed. 
.NET Framework net461 was computed.  net462 was computed.  net463 was computed.  net47 was computed.  net471 was computed.  net472 was computed.  net48 was computed.  net481 was computed. 
MonoAndroid monoandroid was computed. 
MonoMac monomac was computed. 
MonoTouch monotouch was computed. 
Tizen tizen40 was computed.  tizen60 was computed. 
Xamarin.iOS xamarinios was computed. 
Xamarin.Mac xamarinmac was computed. 
Xamarin.TVOS xamarintvos was computed. 
Xamarin.WatchOS xamarinwatchos was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories (1)

Showing the top 1 popular GitHub repositories that depend on AspNetCoreSharedServer.Api:

Repository Stars
FuseCP/FuseCP
Multi Server Control Panel for Windows based on C#
Version Downloads Last Updated
2.0.5 0 5/31/2026
2.0.3 45 5/29/2026
2.0.2 37 5/29/2026
2.0.1 70 5/28/2026 2.0.1 is deprecated because it has critical bugs.
2.0.0 122 5/22/2026 2.0.0 is deprecated because it has critical bugs.
1.3.6 121 4/27/2026
1.3.5 75 3/16/2026
1.3.2 75 3/2/2026
1.3.1 66 3/2/2026
1.3.0 996 11/13/2025
1.2.1 168 10/4/2025
1.2.0 175 9/29/2025
1.1.13 486 9/13/2025
1.1.12 207 9/11/2025
1.1.11 700 7/30/2025
1.1.10 159 7/30/2025
1.1.9 180 7/29/2025
1.1.8 200 7/28/2025
Loading failed