Exemplo n.º 1
0
        static async Task Main(string[] args)
        {
            var o = new GrpcServiceOptions();

            o.AddPort("0.0.0.0", 50001);
            await NetRpcManager.CreateHost(o, null, new Contract <IService, Service>()).RunAsync();
        }
Exemplo n.º 2
0
        static async Task Main(string[] args)
        {
            var host = NetRpcManager.CreateHost(Helper.GetMQOptions(),
                                                null,
                                                new Contract <IServiceAsync, ServiceAsync>());

            Console.WriteLine("Service Opened.");
            await host.RunAsync();

            Console.Read();
        }
Exemplo n.º 3
0
        static async Task Main(string[] args)
        {
            var o = new GrpcServiceOptions();

            o.AddPort("0.0.0.0", 50001);
            var options = new MiddlewareOptions();

            options.UseCallbackThrottling(1000);
            var host = NetRpcManager.CreateHost(o, options, new Contract <IService, Service>());
            await host.RunAsync();
        }
Exemplo n.º 4
0
        static async Task Main(string[] args)
        {
            //rabbitMq
            var mOpt = new MiddlewareOptions();

            mOpt.UseMiddleware <TestGlobalExceptionMiddleware>();
            var mqHost = NetRpcManager.CreateHost(Helper.GetMQOptions(),
                                                  mOpt, new Contract <IService, Service>(), new Contract <IServiceAsync, ServiceAsync>());

            mqHost.RunAsync();

            //grpc
            var grpcHost = NetRpc.Grpc.NetRpcManager.CreateHost(Helper.GetGrpcServiceOptions(),
                                                                null, new Contract <IService, Service>(), new Contract <IServiceAsync, ServiceAsync>());

            grpcHost.RunAsync();
            Console.Read();
        }
Exemplo n.º 5
0
        static async Task Main(string[] args)
        {
            var webHost = NetRpcManager.CreateHost(
                5000,
                "/callback",
                true,
                new HttpServiceOptions {
                ApiRootPath = "/api"
            },
                null,
                new Contract <IServiceAsync, ServiceAsync>());
            await webHost.RunAsync();

            //const string origins = "_myAllowSpecificOrigins";
            //var h = WebHost.CreateDefaultBuilder(null)
            //    .ConfigureServices(services =>
            //    {
            //        services.AddCors(op =>
            //        {
            //            op.AddPolicy(origins, set =>
            //            {
            //                set.SetIsOriginAllowed(origin => true)
            //                    .AllowAnyHeader()
            //                    .AllowAnyMethod()
            //                    .AllowCredentials();
            //            });
            //        });

            //        services.AddSignalR();
            //        services.AddNetRpcSwagger();
            //        services.AddNetRpcHttpService(i => i.ApiRootPath = "/api");
            //        services.AddNetRpcContractSingleton<IServiceAsync, ServiceAsync>();
            //    })
            //    .Configure(app =>
            //    {
            //        app.UseCors(origins);
            //        app.UseSignalR(routes => { routes.MapHub<CallbackHub>("/callback"); });
            //        app.UseNetRpcSwagger();
            //        app.UseNetRpcHttp();
            //    })
            //    .Build();

            //await h.RunAsync();
        }