/// <summary> /// 启动RPC服务器 /// </summary> /// <returns></returns> public static bool StartRpcServer(string remoteIp, int remotePort, string localIp, int localPort) { _remoteIp = remoteIp; _remotePort = remotePort; _localIp = localIp; _localPort = localPort; System.Reflection.Assembly.Load("Sys.Safety.WebApi, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null"); int rpcModel = Basic.Framework.Configuration.ConfigurationManager.FileConfiguration.GetInt("RpcModel", 1); if (rpcModel == 1) { _rpcModel = RpcModel.WebApiModel; } else if (rpcModel == 2) { _rpcModel = RpcModel.gRPCModel; } _client = RpcFactory.CreateRpcClient(_rpcModel, _remoteIp, _remotePort); _server = RpcFactory.CreateRpcServer(_rpcModel); _server.RegistCallback(OnRpcMessageArrived); _server.Start(_localIp, _localPort); return(true); }
public void Run() { blockMiner.Start(); rpcServer.Start(); Console.ReadKey(); blockMiner.Stop(); rpcServer.Stop(); }
public void Start_Rpc_Server_Before_Running_Tests() { var dotNetTestRunner = new DotNetTestRunner(_rpcServerMock, _process); var testProjectOutputPath = "bin/debug"; var coverageContext = new CoverageContext(); dotNetTestRunner.Run(coverageContext, testProjectOutputPath); Received.InOrder(() => { _rpcServerMock.Start(Arg.Any <CoverageContext>()); _process.Execute(Arg.Any <string>(), Arg.Any <string>(), Arg.Any <string>()); }); }
public void Run(CoverageContext coverageContext, string testProjectOutputPath) { var testProjectPath = GetTestProjectPath(testProjectOutputPath); _rpcServer.Start(coverageContext); /* * It is important that the --no-build flag is used, otherwise dotnet-test will run a new build of the project * which will overwrite the assembly files that were instrumented. */ _process.Execute("dotnet", "test --no-build", testProjectPath); _rpcServer.Stop(); }
protected bool StartSlave() { // Create Rpc server _slaveServer = new RpcServer().Create(_slaveEndpoint, _port); // Start Rpc server var t = Task.Run(() => _slaveServer.Start()); Task.Delay(TimeSpan.FromSeconds(5)); if (t.IsFaulted) { return(false); } return(true); }
/// <summary> /// 启动RPC服务器 /// </summary> /// <returns></returns> public bool StartRpcServer() { _server.Start(_localIp, _localPort); //LogHelper.Debug("启动RPC服务器成功"); return(true); }
public void RpcStartCommand() => _rpc?.Start();
public bool StartRpc() { _rpcServer.Start(); return(true); }