AspNetCoreSharedServer.Api
2.0.5
dotnet add package AspNetCoreSharedServer.Api --version 2.0.5
NuGet\Install-Package AspNetCoreSharedServer.Api -Version 2.0.5
<PackageReference Include="AspNetCoreSharedServer.Api" Version="2.0.5" />
<PackageVersion Include="AspNetCoreSharedServer.Api" Version="2.0.5" />
<PackageReference Include="AspNetCoreSharedServer.Api" />
paket add AspNetCoreSharedServer.Api --version 2.0.5
#r "nuget: AspNetCoreSharedServer.Api, 2.0.5"
#:package AspNetCoreSharedServer.Api@2.0.5
#addin nuget:?package=AspNetCoreSharedServer.Api&version=2.0.5
#tool nuget:?package=AspNetCoreSharedServer.Api&version=2.0.5
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 ...
]
}
Namespecifies the name of the application. It must be unique.Assemblydenotes the path to the ASP.NET Core application DLL.Argumentsare optional command line arguments passed to the application.Urlsis the original URL that the application will respond to. This are the urls as received by the proxy server.ListenUrlsare 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.IdleTimeoutis the time in seconds or JSON time value after which the application will be stopped when it is idle.Recycleis the time in seconds or JSON time value after which the application will be restarted, regardless of activity.Environmentis a dictionary of environment variables that will be set for the application when it is started.Disableif true, the application or the server is disabled.Syslogoptional Syslog configuration.FailureLimitnumber of failures withinFailureIntervalin order to disable app pool.FailureIntervaltime 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 | Versions 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. |
-
.NETStandard 2.0
- Mono.Cecil (>= 0.11.6)
- NeoSmart.AsyncLock (>= 3.2.1)
- Newtonsoft.Json (>= 13.0.4)
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.0 | 122 | 5/22/2026 | |
| 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 |