# IpcServiceFramework **Repository Path**: terran-hero/IpcServiceFramework ## Basic Information - **Project Name**: IpcServiceFramework - **Description**: 本开源项目基于 JKang.IpcServiceFramework项目继续扩展完善。 .net8.0中序列化方法改用System.Text.Json中的JsonSerializer静态方法 .netstandard2.0版本仍旧使用Newtonsoft.Json进行序列化 - **Primary Language**: C# - **License**: MIT - **Default Branch**: master - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 0 - **Forks**: 0 - **Created**: 2025-10-02 - **Last Updated**: 2025-10-02 ## Categories & Tags **Categories**: Uncategorized **Tags**: IPC, interprocess, Communication, wcf ## README # IpcServiceFramework 简介 本开源项目基于 JKang.IpcServiceFramework项目继续扩展完善。 .net8.0中序列化方法改用System.Text.Json中的JsonSerializer静态方法 .netstandard2.0版本仍旧使用Newtonsoft.Json进行序列化 | CI build | Stable build | |----------|--------------| |[![Build Status](https://dev.azure.com/jacques-kang/IpcServiceFramework/_apis/build/status/IpcServiceFramework%20CI?branchName=develop)](https://dev.azure.com/jacques-kang/IpcServiceFramework/_build/latest?definitionId=9&branchName=develop)|[![Build Status](https://dev.azure.com/jacques-kang/IpcServiceFramework/_apis/build/status/IpcServiceFramework?branchName=master)](https://dev.azure.com/jacques-kang/IpcServiceFramework/_build/latest?definitionId=14&branchName=master)| # IpcServiceFramework A .NET 8.0 based lightweight framework for efficient inter-process communication. Named pipeline and TCP support out-of-the-box, extensible with other protocols. ## NuGet packages | Name | Purpose | Status | | ---- | ------- | ------ | | IpcServiceFramework.Core.Net | SDK Core | [![NuGet version](https://badge.fury.io/nu/IpcServiceFramework.Core.Net.svg)](https://badge.fury.io/nu/IpcServiceFramework.Core.Net) | | IpcServiceFramework.Client.Net | Client SDK to consume IPC service | [![NuGet version](https://badge.fury.io/nu/IpcServiceFramework.Client.Net.svg)](https://badge.fury.io/nu/IpcServiceFramework.Client.Net) | | IpcServiceFramework.Hosting.Net | Server SDK to run IPC service endpoint | [![NuGet version](https://badge.fury.io/nu/IpcServiceFramework.Hosting.Net.svg)](https://badge.fury.io/nu/IpcServiceFramework.Hosting.Net) | | IpcServiceFramework.Client.NamedPipe.Net | Client SDK to consume IPC service over Named pipe | [![NuGet version](https://badge.fury.io/nu/IpcServiceFramework.Client.NamedPipe.Net.svg)](https://badge.fury.io/nu/IpcServiceFramework.Client.NamedPipe.Net) | | IpcServiceFramework.Client.Tcp.Net | Client SDK to consume IPC service over TCP | [![NuGet version](https://badge.fury.io/nu/IpcServiceFramework.Client.Tcp.Net.svg)](https://badge.fury.io/nu/IpcServiceFramework.Client.Tcp.Net) | | IpcServiceFramework.Hosting.NamedPipe.Net | Server SDK to run Named pipe IPC service endpoint | [![NuGet version](https://badge.fury.io/nu/IpcServiceFramework.Hosting.NamedPipe.Net.svg)](https://badge.fury.io/nu/IpcServiceFramework.Hosting.NamedPipe.Net) | | IpcServiceFramework.Hosting.Tcp.Net | Server SDK to run TCP IPC service endpoint | [![NuGet version](https://badge.fury.io/nu/IpcServiceFramework.Hosting.Tcp.Net.svg)](https://badge.fury.io/nu/IpcServiceFramework.Hosting.Tcp.Net) | ## Usage 1. Create an interface as service contract and package it in an assembly to be referenced by server and client applications, for example: ```csharp public interface IInterProcessService { string ReverseString(string input); } ``` 1. Implement the service in server application, for example: ```csharp class InterProcessService : IInterProcessService { public string ReverseString(string input) { char[] charArray = input.ToCharArray(); Array.Reverse(charArray); return new string(charArray); } } ``` 1. Install the following NuGet packages in server application: ```powershell > Install-Package Microsoft.Extensions.Hosting > Install-Package IpcServiceFramework.Hosting.NamedPipe.Net ``` 1. Register the service implementation and configure IPC endpoint(s): ```csharp class Program { public static void Main(string[] args) { CreateHostBuilder(args).Build().Run(); } public static IHostBuilder CreateHostBuilder(string[] args) => Host.CreateDefaultBuilder(args) .ConfigureServices(services => { services.AddScoped(); }) .ConfigureIpcHost(builder => { // configure IPC endpoints builder.AddNamedPipeEndpoint(pipeName: "pipeinternal"); }) .ConfigureLogging(builder => { // optionally configure logging builder.SetMinimumLevel(LogLevel.Information); }); } ``` 1. Install the following NuGet package in client application: ```powershell > Install-Package IpcServiceFramework.Client.NamedPipe.Net ``` 1. Invoke the server ```csharp // register IPC clients ServiceProvider serviceProvider = new ServiceCollection() .AddNamedPipeIpcClient("client1", pipeName: "pipeinternal") .BuildServiceProvider(); // resolve IPC client factory IIpcClientFactory clientFactory = serviceProvider .GetRequiredService>(); // create client IIpcClient client = clientFactory.CreateClient("client1"); string output = await client.InvokeAsync(x => x.ReverseString(input)); ``` ## FAQs