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

Telerik Reporting - Error registering the viewer with the service - object reference not set

4 Answers 391 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
Chris
Top achievements
Rank 1
Veteran
Iron
Chris asked on 24 Dec 2016, 08:42 AM

HI

I am implementing the report using Telerik Reporting R3 2016

But I met a serious problem while running Report Viewer : 

Error registering the viewer with the service.
An error has occurred.
object reference not set to an instance of an object。

introduce steps:

Existing ReportLibrary - Report1 (DataSource - DataTable) : 

  Telerik Report Library R3 2016

  Report1.cs

    private void Report1_NeedDataSource(object sender, EventArgs e)
    {

      var objectDataSource = new Telerik.Reporting.ObjectDataSource();
      objectDataSource.DataSource = DataTable1;
   
      this.DataSource = objectDataSource; 

    }
 
  *How to: Bind to a DataTable
  http://docs.telerik.com/reporting/object-data-source-how-to-bind-to-data-table

Visual Studio 2015 Enterprise

1.Add > New Project > (.NET Framework 4.6.1) Telerik C# ASP.NET MVC Application

  Standard 2016.2.504.545(Dev)

2.Add Existing Report Libary and add project reference

3.Manage NuGet Packages

  Install Microsoft.Net.Http

  Install Microsoft.AspNet.WebApi

4.Add > New Item > Telerik MVC Report Viewer View R3 2016
 
  Configure reporting engine

    Rest service

    Create new REST service

    Existing report definition
      Type report definition create in Visual Studio
 
  After template the 'Telerik Reporting REST WebAPI Service' successfully configured.

    Controllers\ReportsController.cs

    ReportViewer\js\telerikReportViewer-10.2.16.1025.min.js

 

    and more...

5.Move \ReportViewerView1.cshtml into Home\ReportViewerView1.cshtml


6.Add \Home\ReportViewerView1 Action : 

    public class HomeController : Controller
    {

        public ActionResult ReportViewerView1()
        {
            ViewBag.Message = "ReportViewerView1.";

            return View();
        }

7.Run http://localhost:21797/home/ReportViewerView1 shown :

  Error registering the viewer with the service.
  An error has occurred.
  Object reference not set to an instance of an object.

  (see picture)  

*Works http://localhost:21797/api/reports/formats

[{"name":"PDF","localizedName":"Acrobat (PDF) file"},{"name":"CSV","localizedName":"CSV (comma delimited)"},{"name":"XLS","localizedName":"Excel 97-2003"},{"name":"RTF","localizedName":"Rich Text Format"},{"name":"IMAGE","localizedName":"TIFF file"},{"name":"MHTML","localizedName":"Web Archive"},{"name":"XPS","localizedName":"XPS Document"}]

 
*NOT Works http://localhost:21797/api/reports/client
 

Another problem is, In Visual Studio, the report design/preview are works 
but I need press the 'Refresh' toolbar button to enforce the report show the data 
(the data not displayed automatically while enter preview tab)

Is there have a complete/workable sample project - ASP.NET MVC5 + Report(DataTable)/Report Viewer/Exports.
 
Best regards

Chris

 


4 Answers, 1 is accepted

Sort by
0
Chris
Top achievements
Rank 1
Veteran
Iron
answered on 26 Dec 2016, 12:22 AM

The second problem was solved after reference the forum topic, the detail data was shown instantly when enter the preview tab : 

Reporting R3 2016 Breaks Reports
http://www.telerik.com/forums/reporting-r3-2016-breaks-reports

My OLD implementation : 

      this.DataSource = DataTable1;

->

NEW implementation WORKS :

private void Report1_NeedDataSource(object  sender, System.EventArgs e)
{
    (sender as Telerik.Reporting.Processing.Report).DataSource = DataTable1;
}


*I think this is an importment change and should be announced via mail 
(like The Progress Team sales mail or the news subscribed automatically)

and the first problem still not be solved.


Best regards


Chris






0
Chris
Top achievements
Rank 1
Veteran
Iron
answered on 26 Dec 2016, 01:32 AM

HI

 

I have tried http://localhost:21797/api/reports/clients

<Error>
<Message>
The requested resource does not support http method 'GET'.
</Message>
</Error>

 

I don't know which is 'the requested resource'.

 

Best regards

 

Chris

 

 

0
Chris
Top achievements
Rank 1
Veteran
Iron
answered on 26 Dec 2016, 04:03 AM

HI

>Error registering the viewer with the service - object reference not set ...

The problem was solved after change the HostAppId (from "Html5App" to others) : 

Controllers\ReportsController.cs

      //Setup the ReportServiceConfiguration
      configurationInstance = new ReportServiceConfiguration
      {
        HostAppId = "App1", //"Html5App", 

Why the application can't use the default HostAppId (HostAppId = "Html5App"),
there have only one application running in the same environment.
and the official documentation have no any description about this situation : 

How To: Implement the ReportsController in an application
http://docs.telerik.com/reporting/telerik-reporting-rest-implementing-http-service
ReportServiceConfiguration.HostAppId Property
http://docs.telerik.com/reporting/p-telerik-reporting-services-reportserviceconfiguration-hostappid

So I don't know why the problem to be solved after change the value of HostAppId property.

--

And I found another small problem, why the report viewer always show the text 'Reporting' at bottom (see attachment).


Best regards


Chris

 

 

0
Stef
Telerik team
answered on 26 Dec 2016, 11:25 AM
Hi Chris,

Thank yo for this updates.
  1. The missing data:
    As of R3 2016, there is change invalidating changes on the designed report template when the template is being processed with data. More details about the change can be found in Changes on items in report events are not applied.
    I will forward your suggestion about announcing API changes via e-mails to our product managers.
  2. The problem with the HostAppId:
    The HostAppId property must have an unique value per Reporting REST service, which guarantees its cache entries will be stored correctly for the current application only, without being accessed by other service with the same ID. Beside the HostAppId, verify that the application has valid read/write permissions for the configured Storage - Reporting REST Service Storage.

More troubleshooting suggestions can be found in HTML5 Viewer Troubleshooting.

Regards,
Stef
Telerik by Progress
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
Tags
General Discussions
Asked by
Chris
Top achievements
Rank 1
Veteran
Iron
Answers by
Chris
Top achievements
Rank 1
Veteran
Iron
Stef
Telerik team
Share this question
or