1

I am trying to display the SSRS report in a .Net Core 3.1 MVC application.

I tried to implement the approach mentioned in

https://alanjuden.com/2016/11/10/mvc-net-core-report-viewer/?unapproved=58532&moderation-hash=321d5350c96d2fcf83baa4c939bbdf53#comment-58532

public class ReportsController : AlanJuden.MvcReportViewer.ReportController
{

    protected override ICredentials NetworkCredentials
    {
        get
        {
            //Custom Domain authentication (be sure to pull the info from a config file)
            return new System.Net.NetworkCredential("username", "password");

            //Default domain credentials (windows authentication)
            //return System.Net.CredentialCache.DefaultNetworkCredentials;
        }
    }

    protected override string ReportServerUrl
    {
        get
        {
            //You don't want to put the full API path here, just the path to the report server's ReportServer directory that it creates (you should be able to access this path from your browser: 
            return "https://YourReportServerUrl.com/ReportServer/ReportExecution2005.asmx";
        }
    }
    public IActionResult ProcessReport()
    {
        var model = this.GetReportViewerModel(Request);
        model.ReportPath = "reportPath";
        return RedirectToAction("ReportViewer", model);
    }}

but it is not working with the latest framework. I am getting following error while running the project - Error screenshot

Any help is appreciated. Thanks!

2 Answers2

2

The same thing happened to me, in my case I needed to install the same package that tells you to install

Install-Package System.ServiceModel.Http -Version 4.1.0

or in the nuget look for the package System.ServiceModel.Http

Arjan Einbu
  • 13,543
  • 2
  • 56
  • 59
1

I tried different workarounds with latest .NET Core including the one you mentioned from Alan Juden. However the easiest thing that worked for me is to create a plain .NET WebForms site using the Report Viewer control from Microsoft. It was still a lot of code but this is solid because the Report Viewer control has been around for many years.

In my case it is showing SSRS Report from Angular UI, but the same will work with MVC or any other Web UI because you will actually redirect/navigate to another url (WebForms aspx page).

More details here.

tomerpacific
  • 4,704
  • 13
  • 34
  • 52
iceman
  • 71
  • 1
  • 2