Reporting self hosting

10 posts, 0 answers
  1. Laz
    Laz avatar
    9 posts
    Member since:
    Jul 2013

    Posted 14 May Link to this post

    Cannot self host telerik rest service as the ReportsController uses the HttpContext which is not available when self hosting

    var appPath = HttpContext.Current.Server.MapPath("~/");             

    var reportsPath = Path.Combine(appPath, "Reports");

    what is the recommended work around

    Thanks

  2. Todor
    Admin
    Todor avatar
    310 posts

    Posted 17 May Link to this post

    Hi Laz,

    The code that uses HttpContext just specifies the folder where the Standalone designer reports would be looked for by the ReportFileResolver. If your application needs this resolver you may use an alternative way to specify the folder where the reports are held.

    Regards,
    Todor
    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
  3. Laz
    Laz avatar
    9 posts
    Member since:
    Jul 2013

    Posted 17 May in reply to Todor Link to this post

    Hi Todor

    All my reports are in a library that is referenced by the web api, it seems I do not need the resolver at all do I?

    regards Laz

  4. Todor
    Admin
    Todor avatar
    310 posts

    Posted 17 May Link to this post

    Hi Laz,

    If all the reports are type reports (i.e. CS/VB classes) you probably need only the ReportTypeResolver and can remove the ReportFileResolver, hence the code using the HttpContext. The resolver of the service may be defined just as :

    var resolver = new ReportTypeResolver();


    Regards,
    Todor
    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
  5. Laz
    Laz avatar
    9 posts
    Member since:
    Jul 2013

    Posted 17 May in reply to Todor Link to this post

    Hi 

    Thanks for your help I tried the type resolver as you suggested I get the following error

    Error loading the report viewer's templates. (trvTemplateUrl = 'http://localhost:8000/api/reports/resources/templates/telerikReportViewerTemplate-html').

    I don't believe my application needs a resolver all my project are in class library project referenced by the web api project, in fact the web api does not have a reports folder at all

    Yet it seems to work under IIS

    Regards Laz

     

  6. Laz
    Laz avatar
    9 posts
    Member since:
    Jul 2013

    Posted 20 May in reply to Laz Link to this post

    Hi Todor

    I have made progress by adding  ReportsControllerConfiguration.RegisterRoutes(config); to the windows service host.

    I am using as you suggested

      var resolver = new ReportTypeResolver();

                //Setup the ReportServiceConfiguration
                ConfigurationInstance = new ReportServiceConfiguration
                                        {
                                            HostAppId = "Html5App", Storage = new FileStorage(), ReportResolver = resolver

                                            // ReportSharingTimeout = 0,
                                            // ClientSessionTimeout = 15,
                                        };

    now I have 

    Unable to get report parameters.
    Report 'Reporting.Library.ReportCatalog.ReportCatalog%2C%20Reporting.Library%2C%20Version%3D1.0.0.0%2C%20Culture%3Dneutral%2C%20%20PublicKeyToken%3Dnull' cannot be resolved.

    Please help



  7. Todor
    Admin
    Todor avatar
    310 posts

    Posted 22 May Link to this post

    Hi Laz,

    The error message states that the class ReportCatalog in the namespace Reporting.Library.ReportCatalog in the Reporting.Library assembly cannot be found. My assumption is that this type has been assigned as reportSource->report of the Html5 Report Viewer, i.e. "Reporting.Library.ReportCatalog.ReportCatalog, Reporting.Library, Version=1.0.0.0, Culture=neutral,  PublicKeyToken=null". This assembly should be accessible by the Telerik Reporting REST Service where the Reporting engine is running. So, make sure that this assembly is deployed with the REST Service.

    Regards,
    Todor
    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
  8. Laz
    Laz avatar
    9 posts
    Member since:
    Jul 2013

    Posted 22 May in reply to Todor Link to this post

    Hi Todor,

    But if I switch to IIS hosting it works. it is just self hosting where the problem occurs. and the library project is referenced by the API as well as the the host project  (I know this not needed but just in case)

    Any idea?

  9. Todor
    Admin
    Todor avatar
    310 posts

    Posted 27 May Link to this post

    Hello Laz,

    I tested to setup a Self hosted Telerik Reporting REST Service in a console application as described in the How To: Self Host Telerik Reporting REST Web API article. After enabling CORS the test service resolved successfully TRDP and CS reports (e.g. our demo reports). I have attached the project.

    The ConsoleApp1 is where the service is self-hosted. Note that before running the project it will be necessary to execute the following command in the command prompt (run as Administrator) :

    "netsh http add urlacl url=http://+:8080/ user=everyone"

    The WebAppliation1 project hosts the Html5 Report Viewer, and the CSharp.ReportLibrary project is our demo reports project containing just the BarcodesReport. The TRDP version of the same report is in the ConsoleApp1->Reports folder and can also be displayed in the viewer.

    You may test the sample and try to adjust your project accordingly.

    Regards,
    Todor
    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
  10. Laz
    Laz avatar
    9 posts
    Member since:
    Jul 2013

    Posted 27 May in reply to Todor Link to this post

    Hi Todor

    Thanks for your help, I also resolved the issue the report library also needs to be referenced by the host as well as the web api.

    Thanks for your your help I will check out your sample

Back to Top