Problem With Storage(FileStorage) when changing HostAppId

2 posts, 0 answers
  1. Fernando
    Fernando avatar
    66 posts
    Member since:
    Sep 2012

    Posted 03 Oct 2018 Link to this post

    I have a Web Application using Telerik.Reporting.Services.WebApi with Html5 ReportViewer with a custom controller, where depending on the report type it uses a custom resolver.
    There are 3 different report types and each one uses a HostAppId with a custom resolver. The storage is a Telerik.Reporting.Cache.File.FileStorage pointing to the same path for all 3 report types.

    But after starting the application and generating the first report type, the other 2 types generates information in the storage path, but the report does not display any information, always being '0 pages loaded so far ...'.
    It opens infinite requests - one after another - to an url like this "~/clients/085352-e708/instances/083615-c3d7/documents/085412-2b2a085412-5cbd/info" giving the same json response for them all:
    {
    "documentReady":false,
    "pageCount":0,
    "documentMapAvailable":false,
    "bookmarkNodes":null,
    "documentMapNodes":null
    }

    I believe that somehow by changing HostAppId, the cache is lost. How I fix this?

    ReportBaseController

    public class ReportBaseController<TReportResolver> : ReportsControllerBase
       where TReportResolver : IReportResolver, new()
    {
       protected virtual string HostAppId { get; }

       protected string ReportCachePath => HttpContext.Current.Server.MapPath($"~/App_Data/reportcache");

       public ReportBaseController()
       {
           if (!Directory.Exists(ReportCachePath))
               Directory.CreateDirectory(ReportCachePath);

           this.ReportServiceConfiguration = new ReportServiceConfiguration
           {
               HostAppId = this.HostAppId,
               ReportResolver = new TReportResolver(),
               Storage = new Telerik.Reporting.Cache.File.FileStorage(ReportCachePath)
           };
       }
    }


    Controllers of the 3 different report types:

    public class ReportSystemController : ReportBaseController<SystemReportResolver>
    {
       protected override string HostAppId => "ReportSystem";
    }

    public class ReportClientController : ReportBaseController<ClientReportResolver>
    {
       protected override string HostAppId => "ReportClient";
    }

    public class ReportListController : ReportBaseController<ListReportResolver>
    {
       protected override string HostAppId => "ReportList";
    }
  2. Nasko
    Admin
    Nasko avatar
    1043 posts

    Posted 05 Oct 2018 Link to this post

    Hello Fernando,

    The FileStorage implementation is not suitable to work with multiple Reporting REST service instances. You can use a storage implementation suitable for multiple-instance scenario: IStorage implementation suitable for deploying in Web Farms.

    Another option would be to use a single service per application. What is the purpose of the different ReportsControllerBase implementations in your application?

    Regards,
    Nasko
    Progress Telerik
    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
Back to Top