diff --git a/samples/MicroserviceDemo/applications/AuthServer.Host/AuthServer.Host.csproj b/samples/MicroserviceDemo/applications/AuthServer.Host/AuthServer.Host.csproj index 2e76f7a14c..7622369bfa 100644 --- a/samples/MicroserviceDemo/applications/AuthServer.Host/AuthServer.Host.csproj +++ b/samples/MicroserviceDemo/applications/AuthServer.Host/AuthServer.Host.csproj @@ -15,6 +15,7 @@ + diff --git a/samples/MicroserviceDemo/applications/AuthServer.Host/AuthServerHostModule.cs b/samples/MicroserviceDemo/applications/AuthServer.Host/AuthServerHostModule.cs index db3c0d97ed..45e2fa7f02 100644 --- a/samples/MicroserviceDemo/applications/AuthServer.Host/AuthServerHostModule.cs +++ b/samples/MicroserviceDemo/applications/AuthServer.Host/AuthServerHostModule.cs @@ -35,6 +35,8 @@ namespace AuthServer.Host { public override void ConfigureServices(ServiceConfigurationContext context) { + var configuration = context.Services.GetConfiguration(); + context.Services.AddAbpDbContext(options => { options.AddDefaultRepositories(); @@ -49,6 +51,11 @@ namespace AuthServer.Host { options.Languages.Add(new LanguageInfo("en", "en", "English")); }); + + context.Services.AddDistributedRedisCache(options => + { + options.Configuration = configuration["Redis:Configuration"]; + }); } public override void OnApplicationInitialization(ApplicationInitializationContext context) diff --git a/samples/MicroserviceDemo/applications/AuthServer.Host/appsettings.json b/samples/MicroserviceDemo/applications/AuthServer.Host/appsettings.json index 0cab9fdacf..8733bf454d 100644 --- a/samples/MicroserviceDemo/applications/AuthServer.Host/appsettings.json +++ b/samples/MicroserviceDemo/applications/AuthServer.Host/appsettings.json @@ -2,6 +2,9 @@ "ConnectionStrings": { "Default": "Server=localhost;Database=MsDemo_Identity;Trusted_Connection=True;MultipleActiveResultSets=true" }, + "Redis": { + "Configuration": "127.0.0.1" + }, "Logging": { "LogLevel": { "Default": "Warning" diff --git a/samples/MicroserviceDemo/applications/BackendAdminApp.Host/BackendAdminApp.Host.csproj b/samples/MicroserviceDemo/applications/BackendAdminApp.Host/BackendAdminApp.Host.csproj index 7ee4644f15..b82569afab 100644 --- a/samples/MicroserviceDemo/applications/BackendAdminApp.Host/BackendAdminApp.Host.csproj +++ b/samples/MicroserviceDemo/applications/BackendAdminApp.Host/BackendAdminApp.Host.csproj @@ -17,6 +17,7 @@ + diff --git a/samples/MicroserviceDemo/applications/BackendAdminApp.Host/BackendAdminAppHostModule.cs b/samples/MicroserviceDemo/applications/BackendAdminApp.Host/BackendAdminAppHostModule.cs index 51b1787bee..55a4c76c59 100644 --- a/samples/MicroserviceDemo/applications/BackendAdminApp.Host/BackendAdminAppHostModule.cs +++ b/samples/MicroserviceDemo/applications/BackendAdminApp.Host/BackendAdminAppHostModule.cs @@ -32,6 +32,8 @@ namespace BackendAdminApp.Host { public override void ConfigureServices(ServiceConfigurationContext context) { + var configuration = context.Services.GetConfiguration(); + Configure(options => { options.Languages.Add(new LanguageInfo("en", "en", "English")); @@ -71,6 +73,11 @@ namespace BackendAdminApp.Host options.SwaggerDoc("v1", new Info { Title = "Backend Admin Application API", Version = "v1" }); options.DocInclusionPredicate((docName, description) => true); }); + + context.Services.AddDistributedRedisCache(options => + { + options.Configuration = configuration["Redis:Configuration"]; + }); } public override void OnApplicationInitialization(ApplicationInitializationContext context) diff --git a/samples/MicroserviceDemo/applications/BackendAdminApp.Host/appsettings.json b/samples/MicroserviceDemo/applications/BackendAdminApp.Host/appsettings.json index 3547c1d0cd..014af300a1 100644 --- a/samples/MicroserviceDemo/applications/BackendAdminApp.Host/appsettings.json +++ b/samples/MicroserviceDemo/applications/BackendAdminApp.Host/appsettings.json @@ -4,6 +4,9 @@ "BaseUrl": "http://localhost:65115/" } }, + "Redis": { + "Configuration": "127.0.0.1" + }, "Logging": { "LogLevel": { "Default": "Warning" diff --git a/samples/MicroserviceDemo/applications/PublicWebSite.Host/PublicWebSite.Host.csproj b/samples/MicroserviceDemo/applications/PublicWebSite.Host/PublicWebSite.Host.csproj index 22c886bc63..9e6f268728 100644 --- a/samples/MicroserviceDemo/applications/PublicWebSite.Host/PublicWebSite.Host.csproj +++ b/samples/MicroserviceDemo/applications/PublicWebSite.Host/PublicWebSite.Host.csproj @@ -16,6 +16,7 @@ + diff --git a/samples/MicroserviceDemo/applications/PublicWebSite.Host/PublicWebSiteHostModule.cs b/samples/MicroserviceDemo/applications/PublicWebSite.Host/PublicWebSiteHostModule.cs index 221a9c258c..0c5fc2d3ec 100644 --- a/samples/MicroserviceDemo/applications/PublicWebSite.Host/PublicWebSiteHostModule.cs +++ b/samples/MicroserviceDemo/applications/PublicWebSite.Host/PublicWebSiteHostModule.cs @@ -28,6 +28,8 @@ namespace PublicWebSite.Host { public override void ConfigureServices(ServiceConfigurationContext context) { + var configuration = context.Services.GetConfiguration(); + Configure(options => { options.Languages.Add(new LanguageInfo("en", "en", "English")); @@ -65,6 +67,11 @@ namespace PublicWebSite.Host options.ClaimActions.MapAbpClaimTypes(); }); + + context.Services.AddDistributedRedisCache(options => + { + options.Configuration = configuration["Redis:Configuration"]; + }); } public override void OnApplicationInitialization(ApplicationInitializationContext context) diff --git a/samples/MicroserviceDemo/applications/PublicWebSite.Host/appsettings.json b/samples/MicroserviceDemo/applications/PublicWebSite.Host/appsettings.json index 5840030611..12670d68c3 100644 --- a/samples/MicroserviceDemo/applications/PublicWebSite.Host/appsettings.json +++ b/samples/MicroserviceDemo/applications/PublicWebSite.Host/appsettings.json @@ -4,6 +4,9 @@ "BaseUrl": "http://localhost:64897/" } }, + "Redis": { + "Configuration": "127.0.0.1" + }, "Logging": { "LogLevel": { "Default": "Warning" diff --git a/samples/MicroserviceDemo/gateways/BackendAdminAppGateway.Host/BackendAdminAppGateway.Host.csproj b/samples/MicroserviceDemo/gateways/BackendAdminAppGateway.Host/BackendAdminAppGateway.Host.csproj index 82d878178d..936615b423 100644 --- a/samples/MicroserviceDemo/gateways/BackendAdminAppGateway.Host/BackendAdminAppGateway.Host.csproj +++ b/samples/MicroserviceDemo/gateways/BackendAdminAppGateway.Host/BackendAdminAppGateway.Host.csproj @@ -18,6 +18,7 @@ + diff --git a/samples/MicroserviceDemo/gateways/BackendAdminAppGateway.Host/BackendAdminAppGatewayHostModule.cs b/samples/MicroserviceDemo/gateways/BackendAdminAppGateway.Host/BackendAdminAppGatewayHostModule.cs index 761ff5dba5..889d282186 100644 --- a/samples/MicroserviceDemo/gateways/BackendAdminAppGateway.Host/BackendAdminAppGatewayHostModule.cs +++ b/samples/MicroserviceDemo/gateways/BackendAdminAppGateway.Host/BackendAdminAppGatewayHostModule.cs @@ -28,7 +28,7 @@ namespace BackendAdminAppGateway.Host { public override void ConfigureServices(ServiceConfigurationContext context) { - //TODO: Internal gateway may not need to authentication in the gateway level, we may remove this when we complete and use the other gateways + var configuration = context.Services.GetConfiguration(); context.Services.AddAuthentication("Bearer") .AddIdentityServerAuthentication(options => @@ -60,6 +60,11 @@ namespace BackendAdminAppGateway.Host { options.UseSqlServer(); }); + + context.Services.AddDistributedRedisCache(options => + { + options.Configuration = configuration["Redis:Configuration"]; + }); } public override void OnApplicationInitialization(ApplicationInitializationContext context) diff --git a/samples/MicroserviceDemo/gateways/BackendAdminAppGateway.Host/appsettings.json b/samples/MicroserviceDemo/gateways/BackendAdminAppGateway.Host/appsettings.json index 3576c4e205..5913e851ed 100644 --- a/samples/MicroserviceDemo/gateways/BackendAdminAppGateway.Host/appsettings.json +++ b/samples/MicroserviceDemo/gateways/BackendAdminAppGateway.Host/appsettings.json @@ -2,6 +2,9 @@ "ConnectionStrings": { "Default": "Server=localhost;Database=MsDemo_Identity;Trusted_Connection=True;MultipleActiveResultSets=true" }, + "Redis": { + "Configuration": "127.0.0.1" + }, "ReRoutes": [ { "DownstreamPathTemplate": "/api/identity/{everything}", diff --git a/samples/MicroserviceDemo/gateways/InternalGateway.Host/InternalGateway.Host.csproj b/samples/MicroserviceDemo/gateways/InternalGateway.Host/InternalGateway.Host.csproj index 2ed06dc067..1f09839dfe 100644 --- a/samples/MicroserviceDemo/gateways/InternalGateway.Host/InternalGateway.Host.csproj +++ b/samples/MicroserviceDemo/gateways/InternalGateway.Host/InternalGateway.Host.csproj @@ -18,6 +18,7 @@ + diff --git a/samples/MicroserviceDemo/gateways/InternalGateway.Host/InternalGatewayHostModule.cs b/samples/MicroserviceDemo/gateways/InternalGateway.Host/InternalGatewayHostModule.cs index d8c0d031b9..05907a7062 100644 --- a/samples/MicroserviceDemo/gateways/InternalGateway.Host/InternalGatewayHostModule.cs +++ b/samples/MicroserviceDemo/gateways/InternalGateway.Host/InternalGatewayHostModule.cs @@ -28,7 +28,7 @@ namespace InternalGateway.Host { public override void ConfigureServices(ServiceConfigurationContext context) { - //TODO: Internal gateway may not need to authentication in the gateway level, we may remove this when we complete and use the other gateways + var configuration = context.Services.GetConfiguration(); context.Services.AddAuthentication("Bearer") .AddIdentityServerAuthentication(options => @@ -60,6 +60,11 @@ namespace InternalGateway.Host { options.UseSqlServer(); }); + + context.Services.AddDistributedRedisCache(options => + { + options.Configuration = configuration["Redis:Configuration"]; + }); } public override void OnApplicationInitialization(ApplicationInitializationContext context) diff --git a/samples/MicroserviceDemo/gateways/InternalGateway.Host/appsettings.json b/samples/MicroserviceDemo/gateways/InternalGateway.Host/appsettings.json index 4e0c52d1b8..cf3c02d1ce 100644 --- a/samples/MicroserviceDemo/gateways/InternalGateway.Host/appsettings.json +++ b/samples/MicroserviceDemo/gateways/InternalGateway.Host/appsettings.json @@ -2,6 +2,9 @@ "ConnectionStrings": { "Default": "Server=localhost;Database=MsDemo_Identity;Trusted_Connection=True;MultipleActiveResultSets=true" }, + "Redis": { + "Configuration": "127.0.0.1" + }, "ReRoutes": [ { "DownstreamPathTemplate": "/api/identity/{everything}", diff --git a/samples/MicroserviceDemo/gateways/PublicWebSiteGateway.Host/PublicWebSiteGateway.Host.csproj b/samples/MicroserviceDemo/gateways/PublicWebSiteGateway.Host/PublicWebSiteGateway.Host.csproj index 76fce5dd05..0679c1cae8 100644 --- a/samples/MicroserviceDemo/gateways/PublicWebSiteGateway.Host/PublicWebSiteGateway.Host.csproj +++ b/samples/MicroserviceDemo/gateways/PublicWebSiteGateway.Host/PublicWebSiteGateway.Host.csproj @@ -18,6 +18,7 @@ + diff --git a/samples/MicroserviceDemo/gateways/PublicWebSiteGateway.Host/PublicWebSiteGatewayHostModule.cs b/samples/MicroserviceDemo/gateways/PublicWebSiteGateway.Host/PublicWebSiteGatewayHostModule.cs index 847eca4d81..bf2833ad76 100644 --- a/samples/MicroserviceDemo/gateways/PublicWebSiteGateway.Host/PublicWebSiteGatewayHostModule.cs +++ b/samples/MicroserviceDemo/gateways/PublicWebSiteGateway.Host/PublicWebSiteGatewayHostModule.cs @@ -28,7 +28,7 @@ namespace PublicWebSiteGateway.Host { public override void ConfigureServices(ServiceConfigurationContext context) { - //TODO: Internal gateway may not need to authentication in the gateway level, we may remove this when we complete and use the other gateways + var configuration = context.Services.GetConfiguration(); context.Services.AddAuthentication("Bearer") .AddIdentityServerAuthentication(options => @@ -60,6 +60,11 @@ namespace PublicWebSiteGateway.Host { options.UseSqlServer(); }); + + context.Services.AddDistributedRedisCache(options => + { + options.Configuration = configuration["Redis:Configuration"]; + }); } public override void OnApplicationInitialization(ApplicationInitializationContext context) diff --git a/samples/MicroserviceDemo/gateways/PublicWebSiteGateway.Host/appsettings.json b/samples/MicroserviceDemo/gateways/PublicWebSiteGateway.Host/appsettings.json index 3c99769628..e29e77768a 100644 --- a/samples/MicroserviceDemo/gateways/PublicWebSiteGateway.Host/appsettings.json +++ b/samples/MicroserviceDemo/gateways/PublicWebSiteGateway.Host/appsettings.json @@ -2,6 +2,9 @@ "ConnectionStrings": { "Default": "Server=localhost;Database=MsDemo_Identity;Trusted_Connection=True;MultipleActiveResultSets=true" }, + "Redis": { + "Configuration": "127.0.0.1" + }, "ReRoutes": [ { "DownstreamPathTemplate": "/api/productManagement/{everything}", @@ -13,7 +16,7 @@ } ], "UpstreamPathTemplate": "/api/productManagement/{everything}", - "UpstreamHttpMethod": ["Put", "Delete", "Get", "Post"] + "UpstreamHttpMethod": [ "Put", "Delete", "Get", "Post" ] }, { "DownstreamPathTemplate": "/api/blogging/{everything}", @@ -25,15 +28,13 @@ } ], "UpstreamPathTemplate": "/api/blogging/{everything}", - "UpstreamHttpMethod": ["Put", "Delete", "Get", "Post"] + "UpstreamHttpMethod": [ "Put", "Delete", "Get", "Post" ] } ], - "GlobalConfiguration": - { + "GlobalConfiguration": { "BaseUrl": "http://localhost:64897" }, - "Logging": - { + "Logging": { "LogLevel": { "Default": "Warning" } diff --git a/samples/MicroserviceDemo/microservices/BloggingService.Host/BloggingService.Host.csproj b/samples/MicroserviceDemo/microservices/BloggingService.Host/BloggingService.Host.csproj index 70b6931b8e..60866d75a5 100644 --- a/samples/MicroserviceDemo/microservices/BloggingService.Host/BloggingService.Host.csproj +++ b/samples/MicroserviceDemo/microservices/BloggingService.Host/BloggingService.Host.csproj @@ -17,6 +17,7 @@ + diff --git a/samples/MicroserviceDemo/microservices/BloggingService.Host/BloggingServiceHostModule.cs b/samples/MicroserviceDemo/microservices/BloggingService.Host/BloggingServiceHostModule.cs index af4485eaac..91a92ffb0d 100644 --- a/samples/MicroserviceDemo/microservices/BloggingService.Host/BloggingServiceHostModule.cs +++ b/samples/MicroserviceDemo/microservices/BloggingService.Host/BloggingServiceHostModule.cs @@ -35,6 +35,8 @@ namespace BloggingService.Host { public override void ConfigureServices(ServiceConfigurationContext context) { + var configuration = context.Services.GetConfiguration(); + context.Services.AddAuthentication("Bearer") .AddIdentityServerAuthentication(options => { @@ -63,11 +65,16 @@ namespace BloggingService.Host { options.Languages.Add(new LanguageInfo("en", "en", "English")); }); - + Configure(options => { options.UseSqlServer(); }); + + context.Services.AddDistributedRedisCache(options => + { + options.Configuration = configuration["Redis:Configuration"]; + }); } public override void OnApplicationInitialization(ApplicationInitializationContext context) diff --git a/samples/MicroserviceDemo/microservices/BloggingService.Host/appsettings.json b/samples/MicroserviceDemo/microservices/BloggingService.Host/appsettings.json index 7653620db6..7360894736 100644 --- a/samples/MicroserviceDemo/microservices/BloggingService.Host/appsettings.json +++ b/samples/MicroserviceDemo/microservices/BloggingService.Host/appsettings.json @@ -3,6 +3,9 @@ "Default": "Server=localhost;Database=MsDemo_Identity;Trusted_Connection=True;MultipleActiveResultSets=true", "Blogging": "mongodb://localhost|MsDemo_Blogging" }, + "Redis": { + "Configuration": "127.0.0.1" + }, "Logging": { "LogLevel": { "Default": "Warning" diff --git a/samples/MicroserviceDemo/microservices/IdentityService.Host/IdentityService.Host.csproj b/samples/MicroserviceDemo/microservices/IdentityService.Host/IdentityService.Host.csproj index 2b6eccfb1e..e70345b6bd 100644 --- a/samples/MicroserviceDemo/microservices/IdentityService.Host/IdentityService.Host.csproj +++ b/samples/MicroserviceDemo/microservices/IdentityService.Host/IdentityService.Host.csproj @@ -17,6 +17,7 @@ + diff --git a/samples/MicroserviceDemo/microservices/IdentityService.Host/IdentityServiceHostModule.cs b/samples/MicroserviceDemo/microservices/IdentityService.Host/IdentityServiceHostModule.cs index 9943328008..dd9810bfd9 100644 --- a/samples/MicroserviceDemo/microservices/IdentityService.Host/IdentityServiceHostModule.cs +++ b/samples/MicroserviceDemo/microservices/IdentityService.Host/IdentityServiceHostModule.cs @@ -30,6 +30,8 @@ namespace IdentityService.Host { public override void ConfigureServices(ServiceConfigurationContext context) { + var configuration = context.Services.GetConfiguration(); + context.Services.AddAuthentication("Bearer") .AddIdentityServerAuthentication(options => { @@ -63,6 +65,11 @@ namespace IdentityService.Host { options.UseSqlServer(); }); + + context.Services.AddDistributedRedisCache(options => + { + options.Configuration = configuration["Redis:Configuration"]; + }); } public override void OnApplicationInitialization(ApplicationInitializationContext context) diff --git a/samples/MicroserviceDemo/microservices/IdentityService.Host/appsettings.json b/samples/MicroserviceDemo/microservices/IdentityService.Host/appsettings.json index 0cab9fdacf..8733bf454d 100644 --- a/samples/MicroserviceDemo/microservices/IdentityService.Host/appsettings.json +++ b/samples/MicroserviceDemo/microservices/IdentityService.Host/appsettings.json @@ -2,6 +2,9 @@ "ConnectionStrings": { "Default": "Server=localhost;Database=MsDemo_Identity;Trusted_Connection=True;MultipleActiveResultSets=true" }, + "Redis": { + "Configuration": "127.0.0.1" + }, "Logging": { "LogLevel": { "Default": "Warning" diff --git a/samples/MicroserviceDemo/microservices/ProductService.Host/ProductService.Host.csproj b/samples/MicroserviceDemo/microservices/ProductService.Host/ProductService.Host.csproj index 674b5990fb..884e2fd20d 100644 --- a/samples/MicroserviceDemo/microservices/ProductService.Host/ProductService.Host.csproj +++ b/samples/MicroserviceDemo/microservices/ProductService.Host/ProductService.Host.csproj @@ -17,6 +17,7 @@ + diff --git a/samples/MicroserviceDemo/microservices/ProductService.Host/ProductServiceHostModule.cs b/samples/MicroserviceDemo/microservices/ProductService.Host/ProductServiceHostModule.cs index d946556279..31c3c612fd 100644 --- a/samples/MicroserviceDemo/microservices/ProductService.Host/ProductServiceHostModule.cs +++ b/samples/MicroserviceDemo/microservices/ProductService.Host/ProductServiceHostModule.cs @@ -30,6 +30,8 @@ namespace ProductService.Host { public override void ConfigureServices(ServiceConfigurationContext context) { + var configuration = context.Services.GetConfiguration(); + context.Services.AddAuthentication("Bearer") .AddIdentityServerAuthentication(options => { @@ -63,6 +65,11 @@ namespace ProductService.Host { options.UseSqlServer(); }); + + context.Services.AddDistributedRedisCache(options => + { + options.Configuration = configuration["Redis:Configuration"]; + }); } public override void OnApplicationInitialization(ApplicationInitializationContext context) diff --git a/samples/MicroserviceDemo/microservices/ProductService.Host/appsettings.json b/samples/MicroserviceDemo/microservices/ProductService.Host/appsettings.json index d2bd2c33bd..3cd53f1090 100644 --- a/samples/MicroserviceDemo/microservices/ProductService.Host/appsettings.json +++ b/samples/MicroserviceDemo/microservices/ProductService.Host/appsettings.json @@ -3,6 +3,9 @@ "Default": "Server=localhost;Database=MsDemo_Identity;Trusted_Connection=True;MultipleActiveResultSets=true", "ProductManagement": "Server=localhost;Database=MsDemo_ProductManagement;Trusted_Connection=True;MultipleActiveResultSets=true" }, + "Redis": { + "Configuration": "127.0.0.1" + }, "Logging": { "LogLevel": { "Default": "Warning"