Пример #1
0
 public override void BeforeConfigureServices(CafConfigurationContext context)
 {
     context.AddCafCors(o => { o.ConfigurationSection = "App:CorsOrigins"; o.Enable = true; });//添加跨域
     context.UseGrpcClientForDirectConnection(new[]
     {
         new GrpcServerNode
         {
             GrpcServiceIp   = "127.0.0.1",
             GrpcServiceName = "TestServiceName",
             GrpcServicePort = 8989
         }
     }).AddRpcClientAssembly(typeof(GrpcTestMoudle).Assembly);
     context.Services.AddHttpClient("webapi", c =>
     {
         c.BaseAddress = new Uri("http://localhost:44300/");
     });
     context.Services.AddControllers();
 }
Пример #2
0
        public override void BeforeConfigureServices(CafConfigurationContext context)
        {
            context.Services.AddSingleton <ITestNewService, TestNewService>();
            context.Services.AddSingleton <ITestService, TestService>();

            context.AddCafCors(o => { o.ConfigurationSection = "App:CorsOrigins"; o.Enable = true; });//添加跨域

            //context.UseGrpcService
            //    (
            //    o => {
            //        o.GrpcBindAddress = "0.0.0.0";
            //        o.GrpcBindPort = 8989;
            //    }).AddRpcServiceAssembly(typeof(sampleModule).Assembly);


            //添加JWT验证
            context.AddCafJWTAuth(o =>
            {
                o.Audience    = "caf";
                o.Expiration  = TimeSpan.FromDays(2);
                o.Issuer      = "caf";
                o.SecurityKey = "cafHKDH823J$5DSGS!@$g";
            });
        }
Пример #3
0
 public override void BeforeConfigureServices(CafConfigurationContext context)
 {
     context.AddCafCors(o => { o.ConfigurationSection = "App:CorsOrigins"; o.Enable = true; });//添加跨域
 }