A .NET Core lightweight inter-process communication framework allowing invoking a service via named pipeline (in a similar way as WCF, which is currently unavailable for .NET Core).
Support using primitive or complexe types in service contract.
Support multi-threading on server side with configurable number of threads.
ASP.NET Core Dependency Injection framework friendly.
- Create an interface as service contract and package it in an assembly to be shared between server and client.
- Implement the service and host it in an console or web applciation
- Invoke the service with framework provided proxy client
IpcServiceFramework is available via NuGet:
public interface IComputingService
{
float AddFloat(float x, float y);
}
class ComputingService : IComputingService
{
public float AddFloat(float x, float y)
{
return x + y;
}
}
class Program
{
static void Main(string[] args)
{
// configure DI
IServiceCollection services = ConfigureServices(new ServiceCollection());
// run IPC service host
IpcServiceHostBuilder
.Buid("pipeName", services.BuildServiceProvider())
.Run();
}
private static IServiceCollection ConfigureServices(IServiceCollection services)
{
return services
.AddIpc(options =>
{
options.ThreadCount = 4;
})
.AddService<IComputingService, ComputingService>();
}
}
It's possible to host IPC service in web application, please check out the sample project IpcServiceSample.WebServer
var proxy = new IpcServiceClient<IComputingService>("pipeName");
float result = await proxy.InvokeAsync(x => x.AddFloat(1.23f, 4.56f));
Please feel free to download, fork and/or provide any feedback!