NginxCSharp 9.0.0

dotnet add package NginxCSharp --version 9.0.0
                    
NuGet\Install-Package NginxCSharp -Version 9.0.0
                    
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="NginxCSharp" Version="9.0.0" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="NginxCSharp" Version="9.0.0" />
                    
Directory.Packages.props
<PackageReference Include="NginxCSharp" />
                    
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 NginxCSharp --version 9.0.0
                    
#r "nuget: NginxCSharp, 9.0.0"
                    
#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 NginxCSharp@9.0.0
                    
#: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=NginxCSharp&version=9.0.0
                    
Install as a Cake Addin
#tool nuget:?package=NginxCSharp&version=9.0.0
                    
Install as a Cake Tool

NginxCSharp NuGet

C# Library for the Nginx+ API.
Based on the NginixPlus demo Swagger documentation.

Unfortunately, my access to a test environment for this code was limited (as was my time) so there are no unit tests or integration tests. Use at your own risk.

Sample code
static void Main(string[] args)
{
    try
    {
        //set up the base url for the api
        string baseUrl = "http://192.168.23.185:8080/api/9/";

        //create the http client
        var httpClient = new System.Net.Http.HttpClient();

        //authenticate if needed
        //var authByteArray = Encoding.ASCII.GetBytes($"admin:password"); 
        //var authString = Convert.ToBase64String(authByteArray);
        //httpClient.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Basic", authString);

        //create the client
        var client = new Client(baseUrl, httpClient);

        //get the nginx object
        var niginx = GetNginx(client).ConfigureAwait(false).GetAwaiter().GetResult();

        //get the endoints
        var endpoints = GetEndpoints(client).ConfigureAwait(false).GetAwaiter().GetResult();
    }
    catch (Exception e)
    {
        Console.WriteLine(e);
        throw;
    }
}

private static async Task<ICollection<string>> GetEndpoints(Client client)
{
    try
    {
        return await client.GetAPIEndpointsAsync();
    }
    catch (Exception e)
    {
        Console.WriteLine(e);
        throw;
    }
}

private static async Task<NginxObject> GetNginx(Client client)
{
    try
    {
                              
        return await client.GetNginxAsync("version,build,address,generation,load_timestamp,timestamp,pid,ppid");
    }
    catch (Exception e)
    {
        Console.WriteLine(e);
        throw;
    }
}
Product Compatible and additional computed target framework versions.
.NET net10.0 is compatible.  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. 
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

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
9.0.0 111 6/16/2026
1.0.0 3,136 2/28/2020