This is a migrated thread and some comments may be shown as answers.

Angular Reporting Clients Registration

2 Answers 120 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
Denis
Top achievements
Rank 1
Denis asked on 08 Sep 2020, 02:49 PM

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.

 

2 Answers, 1 is accepted

Sort by
0
Neli
Telerik team
answered on 11 Sep 2020, 01:18 PM

Hi Denis,

We are sorry to hear that you are experiencing a problem during the usage of our product. Basically, we haven't tested such a scenario. To be able to investigate further can you please attach a trace listener to the application and send us the log file.

Regards,
Neli
Progress Telerik

Five days of Blazor, Angular, React, and Xamarin experts live-coding on twitch.tv/CodeItLive , special prizes and more, for FREE?! Register now for DevReach 2.0(20).

0
Denis
Top achievements
Rank 1
answered on 11 Sep 2020, 02:19 PM

Thank, for answer problem was solved.

There is was problem with Anti-Forgery token (which must be turn-of for Reporting Rest Controller) and second connection to Redist must be registered as singletone (.AddSingletone(connection)). 

Tags
General Discussions
Asked by
Denis
Top achievements
Rank 1
Answers by
Neli
Telerik team
Denis
Top achievements
Rank 1
Share this question
or