static void Main(string[] args) { var server = new RpcServer("127.0.0.1", 12345) .Map <IHelloService, HelloService>(); Console.WriteLine("开始接收请求..."); server.Run(); }
public void Test1() { var server = new RpcServer(new FakeServerTransport()); var task = new Task(() => server.Run()); task.Start(); Thread.Sleep(1000); server.Shutdown(false); }
private static void ServerThread() { var transport = new SocketServerTransport(4242); var server = new RpcServer(transport); Program.serverInstance = server; var service = new SettingsService(server.EventSource); server.RegisterService(service); server.Run(); service.Dispose(); }
static void Main(string[] args) { AppSeed.Instance.InitConfig(); RpcServer rpcServer = new RpcServer(); var rpcServerConfig = ConfigHelper.Instance.GetComponentConfig(); if ((rpcServerConfig == null) || (rpcServerConfig.ServiceConfig == null)) { Console.WriteLine("RPC服务端未配置"); } else { rpcServer.Run(rpcServerConfig.ServiceConfig); } }
public ServerFixture() { var builder = new ContainerBuilder(); builder.UseRpcSession(); builder.RegisterRpcProvider <TestServiceA, ITestServiceA>().InstancePerChannel(); builder.RegisterRpcProvider <TestServiceB, ITestServiceB>().SingleInstance(); Server = new RpcServer(builder.Build()) { Debug = true }; Server.Bind(9999); Server.Run().Wait(); }
public ServerFixture() { var services = new ServiceCollection(); services.AddLogging(lb => { lb.AddConsole(); }); var builder = new ContainerBuilder(); builder.Populate(services); builder.UseRpcSession(); builder.RegisterRpcProvider <TestServiceA, ITestServiceA>().InstancePerChannel(); builder.RegisterRpcProvider <TestServiceB, ITestServiceB>().SingleInstance(); var container = builder.Build(); Server = new RpcServer(container) { Debug = true }; Server.Bind(9999); Server.Run().Wait(); }