Exemplo n.º 1
0
        protected void Application_Start()
        {
            AreaRegistration.RegisterAllAreas();
            RouteConfig.RegisterRoutes(RouteTable.Routes);
            //启动GRPC服务 使用本地服务的50051端口
            const int Port   = 50051;
            Server    server = new Server
            {
                Services =
                {
                    GetUser.BindService(new GetUserActionI()),
                    //GetUserList.BindService(new GetUserI())
                },
                Ports = { new ServerPort("localhost", Port, ServerCredentials.Insecure) }
            };

            Server server1 = new Server
            {
                Services =
                {
                    // GetUser.BindService(new GetUserActionI()),
                    GetUserList.BindService(new GetUserI())
                },
                Ports = { new ServerPort("localhost", Port, ServerCredentials.Insecure) }
            };

            server.Start();
            server1.Start();

            //server.ShutdownAsync().Wait();
        }