HttpJsonRpc 2.5.6

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

HttpJsonRpc

HttpJsonRpc is a cross-platform, .NET Standard library that implements the JSON-RPC 2.0 Specification, as well as streaming (up and down), on top of HTTP.

It makes it simple to create high performance, robust, light-weight API's that can be hosted in any project type. There is no dependency on ASP.NET.

HttpJsonRpc also has extensibility points for logging and dependency injection, so you can use your favorite frameworks.

Getting Started

  1. Create a class that will hold your JsonRpc methods with the JsonRpcClassAttribute.
[JsonRpcClass("math")]
public static class MathApi
{
    [JsonRpcMethod]
    public static Task<int> SumAsync(int n1, int n2)
    {
        var result = n1 + n2;

        return Task.FromResult(result);
    }
}
  1. Call the JsonRpc.Start method to start listening for JSON-RPC requests over HTTP.
class Program
{
    static void Main(string[] args)
    {
        JsonRpc.Start();

        Console.ReadLine();
    }
}
  1. The ideal way to call JSON-RPC methods is using an HTTP POST with the JSON-RPC Request in the HTTP Body but HttpJsonRpc also supports URL Parameters for simple method calls. Test the method by pasting the URL in a browser.
http://localhost:5000/?method=math.sum&n1=2&n2=2

You should get the result in JSON.

{
    "jsonrpc": "2.0",
    "result": 4
}

When calling your method in code or Postman use an HTTP POST with the JSON-RPC Request in the HTTP Body.

{
	"jsonrpc": "2.0",
	"method": "math.sum",
	"params": {
		"n1": 2,
		"n2": 2
	},
	"id": "1"
}
  1. You can add your favorite logging provider by setting the JsonRpc.LoggerFactory property. This sample uses Serilog.
Log.Logger = new LoggerConfiguration()
    .WriteTo.Console()
    .CreateLogger();

JsonRpc.LoggerFactory = new LoggerFactory().AddSerilog();
JsonRpc.Start();
  1. You can find more code samples here.
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

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
2.5.6 0 12/24/2025
2.5.5 0 12/24/2025
2.5.4 0 12/24/2025
2.5.3 0 12/24/2025
2.5.2 35 12/23/2025
2.5.1 28 12/23/2025
2.5.0 36 12/23/2025
2.4.1 280 8/28/2025
2.4.0 144 8/15/2025
2.3.0 209 8/4/2025
2.2.0 293 9/20/2023
2.1.1 326 5/16/2023
2.1.0 310 5/16/2023
2.0.1.4 657 5/8/2022
2.0.0.1 608 5/2/2022
1.3.9 619 4/25/2022
1.3.8 857 6/25/2020
1.3.7 674 4/18/2020
1.3.6 690 4/16/2020
1.3.5 692 4/16/2020
1.3.4 711 4/16/2020
1.3.3 1,027 7/29/2019
1.3.2 1,256 1/30/2019
1.3.1 1,127 1/16/2019
1.3.0 1,112 1/6/2019
1.2.3 1,065 12/8/2018
1.2.2 1,048 12/8/2018
1.2.1 1,108 12/8/2018
1.2.0 1,096 12/1/2018
1.1.27 1,133 11/26/2018
1.1.26 1,163 10/18/2018
1.1.25 1,229 9/26/2018
1.1.24 1,182 9/12/2018
1.1.23 1,167 9/11/2018
1.1.22 1,189 9/10/2018
1.1.21 1,223 9/10/2018
1.1.20 1,226 9/10/2018
1.1.19 1,227 9/7/2018
1.1.18 1,669 7/16/2018
1.1.17 1,598 7/8/2018
1.1.16 1,654 5/22/2018
1.1.15 1,627 5/22/2018
1.1.14 1,584 5/22/2018
1.1.13 1,613 5/22/2018
1.1.12 1,762 5/17/2018
1.1.11 1,773 5/17/2018
1.1.10 1,666 5/3/2018
1.1.9 1,651 5/2/2018
1.1.8 1,699 5/2/2018
1.1.7 1,777 5/2/2018
1.1.6 1,692 4/27/2018
1.1.5 1,743 3/19/2018
1.1.4 1,646 3/19/2018
1.1.3 1,651 3/18/2018
1.1.2 1,650 3/15/2018
1.1.1 1,643 3/10/2018
1.1.0 1,658 3/10/2018
1.0.25 1,678 3/9/2018
1.0.24 1,648 3/5/2018
1.0.23 1,715 12/12/2017
1.0.22 1,979 12/11/2017
1.0.21 1,961 12/11/2017
1.0.20 1,688 12/11/2017
1.0.19 1,884 12/11/2017
1.0.18-beta 1,239 11/28/2017
1.0.17-beta 1,217 11/10/2017
1.0.16-beta 1,245 11/9/2017
1.0.15-beta 1,255 11/9/2017
1.0.14-beta 1,284 11/9/2017
1.0.13-beta 1,240 11/8/2017
1.0.12-beta 1,256 11/8/2017
1.0.11-beta 1,240 11/8/2017
1.0.10-beta 1,257 11/6/2017
1.0.9-beta 1,258 11/5/2017
1.0.8-beta 1,260 11/4/2017
1.0.7-beta 1,286 11/4/2017
1.0.6-beta 1,298 11/4/2017
1.0.5-beta 1,256 11/4/2017
1.0.4-beta 1,232 11/3/2017
1.0.3-beta 1,209 10/31/2017
1.0.2-beta 1,244 10/31/2017
1.0.1-beta 1,270 10/29/2017
1.0.0-beta 1,274 10/28/2017