DotNettyRPC is a cross-platform RPC framework based on DotNetty, supporting .NET45 and .NET Standard 2.0
When encountering remote calls services in traditional .NET development, WCF is the main focus. Although WCF has powerful functions, its configuration is complex and not easy to use. And in the future, it will definitely be the world of .NET Core. WCF does not support .NET Core for the time being (only clients, no server can be established). Other .NET RPC frameworks on the market, such as gRPC, surging and even microservice framework Orleans, are powerful, have good performance, and are relatively mature, but they are not simple enough to use. Based on the above comparison (without any praising and belittlement), I have just taken a wheel DotNettyRPC. Its positioning is a cross-platform (.NET45 and .NET Standard), simple but practical RPC framework.
Open the Nuget Package Manager, search DotNettyRPC to find and use it
Or enter the Nuget command: Install-Package DotNettyRPC
public interface IHello
{
string SayHello ( string msg ) ;
}
public class Hello : IHello
{
public string SayHello ( string msg )
{
return msg ;
}
} using Coldairarrow . DotNettyRPC ;
using Common ;
using System ;
namespace Server
{
class Program
{
static void Main ( string [ ] args )
{
RPCServer rPCServer = new RPCServer ( 9999 ) ;
rPCServer . RegisterService < IHello , Hello > ( ) ;
rPCServer . Start ( ) ;
Console . ReadLine ( ) ;
}
}
} using Coldairarrow . DotNettyRPC ;
using Common ;
using System ;
namespace Client
{
class Program
{
static void Main ( string [ ] args )
{
IHello client = RPCClientFactory . GetClient < IHello > ( "127.0.0.1" , 9999 ) ;
var msg = client . SayHello ( "Hello" ) ;
Console . WriteLine ( msg ) ;
Console . ReadLine ( ) ;
}
}
}Run the server first, and then run the client, and you can output Hello on the client
The average RPC request for testing in this machine is about 0.4ms, which is not high in performance, but it is enough to cope with most business scenarios, with a focus on simplicity and practicality. There are many places that can be optimized, and I hope everyone can support it.
GitHub address: https://github.com/Coldairarrow/DotNettyRPC
QQ group: 373144077