Good day!
Trying Angular reporting with Asp.net core 3.1. Build in our application to try how it would work in our envirnoment. When I'm running application out of docker it all works fine. But as far i'm trying to run in in docker-compose with redis for cach it allways failed on registering new Angular client () it returns 400 response. Due to known isues it might be wrong connection to redis, but I have added random number input in redis and connection works fine.
CustomReportServiceConfiguration:
public class CustomReportServiceConfiguration : ReportServiceConfiguration
{
/// <
summary
>
/// Инициализирует новый экземпляр класса <
see
cref
=
"CustomReportServiceConfiguration"
/>.
/// </
summary
>
public CustomReportServiceConfiguration(
IReportSourceResolver reportSourceResolver,
ConnectionMultiplexer connection) : base()
{
var redisStorage = new RedisStorage(connection);
var guid = Guid.NewGuid();
redisStorage.SetString(DateTime.Now.ToString("dd-MM-yyyy HH:mm ") + "testKey-" + guid, "testValue-" + guid);
HostAppId = "ArmCod";
Storage = redisStorage;
ReportSourceResolver = reportSourceResolver;
}
}
Configuration:
services.AddScoped<
IRegionReporting
, RegionReportingService>(); //-Controller for reporting service
services.TryAddScoped<
IReportSourceResolver
>(sp =>
new UriReportSourceResolver(
Path.Combine(sp.GetService<
IWebHostEnvironment
>().ContentRootPath, "Reports")));
services.AddScoped<
ConnectionMultiplexer
>(x=> ConnectionMultiplexer.Connect("redis:6379"));
services.AddScoped<
IReportServiceConfiguration
, CustomReportServiceConfiguration>();
Compose file:
version: '3'
services:
web:
depends_on:
- "redis"
build:
context: .
dockerfile: ./src/Dpc/AdministrationPortal/Stf.WebApp/Dockerfile
ports:
- "9901:80"
links:
- "redis"
redis:
image: redis:latest
ports:
- 6379:6379
volumes:
- ./redis.conf:/redis.conf
command: [ "redis-server", "/redis.conf" ]
So when it run from Visual Studio in localhost envirnoment all fine, when redis work in docker and app in localhost all work fine. But when both (app and redis) runs in docker, reporting always failed with 400 error upon trying to register new client with post request at api/RegionReporting/clients in same time '/formats' works fine.