Beispiel #1
0
        internal void Spawn(int port)
        {
            var mp = Process.GetCurrentProcess();

            var startInfo = new ProcessStartInfo(mp.MainModule.FileName, "--worker");

            startInfo.EnvironmentVariables["ASPNETCORE_URLS"] = $"https://localhost:{port}";
            startInfo.UseShellExecute = false;
            process = Process.Start(startInfo);

            channel = GrpcChannel.ForAddress($"https://localhost:{port}");

            client = new Api.Program.ProgramClient(channel);
        }
        private void spawn(int port)
        {
            var mp = Process.GetCurrentProcess();

            var startInfo = new ProcessStartInfo(mp.MainModule.FileName, "--worker");

            startInfo.EnvironmentVariables["_WORKER_PORT"] = $"{port}";
            startInfo.UseShellExecute = false;
            process = Process.Start(startInfo);

            var httpHandler = new HttpClientHandler();

            httpHandler.ServerCertificateCustomValidationCallback = HttpClientHandler.DangerousAcceptAnyServerCertificateValidator;

            channel = GrpcChannel.ForAddress($"http://localhost:{port}", new GrpcChannelOptions()
            {
                HttpHandler = httpHandler
            });

            client = new Api.Program.ProgramClient(channel);
        }