static async Task Main(string[] args) { var o = new NGrpcServiceOptions(); o.AddPort("0.0.0.0", 50001); await NManager.CreateHost(o, null, new ContractParam <IService, Service>()).RunAsync(); }
static async Task Main(string[] args) { var host = NManager.CreateHost(Helper.GetMQOptions(), null, new ContractParam <IServiceAsync, ServiceAsync>()); Console.WriteLine("Service Opened."); await host.RunAsync(); Console.Read(); }
static async Task Main(string[] args) { var o = new NGrpcServiceOptions(); o.AddPort("0.0.0.0", 50001); var options = new MiddlewareOptions(); options.UseCallbackThrottling(1000); var host = NManager.CreateHost(o, options, new ContractParam <IService, Service>()); await host.RunAsync(); }
static async Task Main(string[] args) { //rabbitMQ var mOpt = new MiddlewareOptions(); mOpt.UseMiddleware <TestGlobalExceptionMiddleware>(); var mqHost = NManager.CreateHost(Helper.GetMQOptions(), mOpt, new ContractParam <IService, Service>(), new ContractParam <IServiceAsync, ServiceAsync>()); mqHost.RunAsync(); //grpc var grpcHost = NetRpc.Grpc.NManager.CreateHost(Helper.GetGrpcServiceOptions(), null, new ContractParam <IService, Service>(), new ContractParam <IServiceAsync, ServiceAsync>()); grpcHost.RunAsync(); Console.Read(); }
static async Task Main(string[] args) { var webHost = NManager.CreateHost( 5000, "/callback", true, new HttpServiceOptions { ApiRootPath = "/api" }, null, new ContractParam <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.AddNHttpService(i => i.ApiRootPath = "/api"); // services.AddNetRpcContractSingleton<IServiceAsync, ServiceAsync>(); // }) // .Configure(app => // { // app.UseCors(origins); // app.UseSignalR(routes => { routes.MapHub<CallbackHub>("/callback"); }); // app.UseNetRpcSwagger(); // app.UseNHttp(); // }) // .Build(); //await h.RunAsync(); }