MVC .NET Core Report Viewer

Last week I released some code that I created for work to get rid of the ASP.NET WebForms reliance to use a Report Viewer control on your MVC website. Immediately after release, someone commented on my reddit article suggesting that I should see what it would take to enable this for .NET Core. I thought it would be a fun idea to gain some experience with .NET Core so I went for.

The other day, I released the code for the .NET Core portion of the project on the same Github repo and I wanted to share it and see if anyone else wants to try using it.

The way that my code works for viewing the reports is that I’m essentially redrawing the report viewer controls for paging / searching / exporting / printing using Bootstrap (which you don’t have to be tied to). Each button does an ajax call to the controller which has some predefined controller actions to deal with the report viewer features so that you don’t have to reinvent the wheel. The custom controller actions will call into your SSRS ReportExecutionService soap service to get information about the report.

There are sample projects in my codebase that are for the standard ASP.NET MVC Razor and for the .NET Core version of MVC.

Worth Noting

  • This project will work in standard MVC projects as well as .NET Core (there is a library for each).
  • I have only tested this with SSRS Server Reports – since I’m contacting the SSRS ReportExecution asmx file I don’t believe that would work with local rdl files.
  • I’m using the following libraries in my example projects currently
    • JQuery v2.1.1
    • Bootstrap v3.3.7
    • Select2 v4.0.3
    • JQuery Highlight v5 (this is optional and is used for the “Find” feature of the viewer).

How to Set it Up

  1. Install from NuGet packages
    1. Standard .NET Framework – https://www.nuget.org/packages/AlanJuden.MvcReportViewer/
    2. .NetCore – https://www.nuget.org/packages/AlanJuden.MvcReportViewer.NetCore/
    3. Or, download code from GitHub – https://github.com/alanjuden/MvcReportViewer
  2. Hopefully you already have a project created, if not…set one up.
  3. Determine the correct AlanJuden.MvcReportViewer library to use.
    1. .Net Core based project => AlanJuden.MvcReportViewer.NetCore
    2. ASP.NET MVC based project => AlanJuden.MvcReportViewer
  4. Compile the project you chose from step 3 or pull it into your project.
  5. In your project, you need to setup a ReportController (that’s what I’ve been calling it but you can call it whatever you want).
  6. On your ReportController, you’ll need to inherit from AlanJuden.MvcReportViewer.ReportController.
  7. Add the mvcreportviewer-bootstrap.css to your project.
  8. You’ll now need to setup a couple of properties that are expected by being abstracted on the base ReportController.
    1. This would be a good time to setup the credentials that you need to run as to have access on the report viewer.
  9. Setup a View Page for your Report Viewer, I have been calling mine “ReportViewer.cshtml” (this should live in your /Views/Report/ directory).
    1. You may need to edit the path to some of your script / css files.
  10. Start setting up your own reports on your controller.
  11. You’re all set…give it a try!
  12. Let me know what you think by hitting me up on the comments below, by my contact page, or any of the social sites I have listed on my site.

You may also like...

76 Responses

  1. Prashanth B says:

    Hi Alan,
    i am getting “The HTTP request was forbidden with client authentication scheme ‘Ntlm’.” exception when trying execute the code. Your help is much appreciated.

    • Alan says:

      @Prashanth B

      I can’t guarantee that I can help you as everyone’s environment is different but I can give it a shot.

      I have a few questions for you:

      1. How did you set everything up? Did you pull my code and set it up manually or did you use the NuGet installer?
      2. Are you running on standard MVC or on .NetCore?
      3. Have you adjusted your default credentials in the ReportController? (property is named “NetworkCredentials”)

      Thanks,

      Alan

  2. Mark says:

    My reportcontroller handler gets a null Request object and crashes. If I ignore the Request, the handler merely returns a JSON object, not a view.

    • Alan says:

      @Mark

      Any chance you could let me know if you’re in .NetCore or standard MVC? Also, if you could give me a sample or copy of your controller that would be awesome!

      Alan

  3. jan says:

    Hi,

    thanks for this solution. Everything works fine. But the main problem of this is, that the report need to be public for the client. Because you load it with the client side javascript.
    You can see in browsers developer tool a POST request to the report server.
    Original reportViewer control for WebForms load the report on server and only render it for client. That means, the report server (SSRS) can be directly unaccessible for the client but accessible for application server. Only your application with reportViewer allows client to see the report. This is important when you want to control access to reports from your application layer.

    • Alan says:

      @jan

      The client side makes no direct post requests to the SSRS server only to your controller action (the client side of the application makes a request to the web server, then the web server makes the request to the SSRS web service). The client does not need direct access to the SSRS web service.

      Alan

      • jan says:

        Thanks for you reply. You’re right. From client side is reading the image, that is embedded in my report. So i need to find some workaround (probably remove the image from report 😀 ).

  4. Stefan says:

    This is awesome, thank you for saving me a huge headache!

  5. Stephan says:

    I get this when adding the nuget package to my app. What are the compatibility requirements around this control?

    Package AlanJuden.MvcReportViewer 1.0.1 is not compatible with netcoreapp1.0 (.NETCoreApp,Version=v1.0). Package AlanJuden.MvcReportViewer 1.0.1 supports: net452 (.NETFramework,Version=v4.5.2)

    • Alan says:

      Hey @Stephan, I haven’t yet packaged up a NuGet package of the .NetCore version. Your issue is that you’ve pulled in the standard .net version into your .NetCore project. If you pull the code (or download) from github you can compile the AlanJuden.MvcReportViewer.NetCore project you can grab the dll from there.

      Hope this helps!

      Alan

  6. Stephan says:

    That worked. Apparently in VS2015 .netCore you are not able to reference a DLL directly it must be done through Nuget, so I just added your .netCore project to my solution and was able to add the reference that way. Thanks by the way this looks awesome and it fills in a gap that Microsoft has yet to resolve with .netCore

  7. deco says:

    What about setting a report viewer in .net core Angular 2 project ?

    • Alan says:

      @deco, I don’t see any reason you wouldn’t be able to use the .NetCore version of my report viewer in your project. I just created a sample project based off of your spec and was able to compile (I don’t have access to my report server at the moment to test that portion but it appeared to act as normal when accessing the ReportController).

  8. hussein says:

    hello Alan,
    thanks for your code , everything is running well but unfortunately my report content in Arabic “data comes from sql server ” but its appear question mark “????????” in report viewer , if i open link direct from url its working fine
    any idea?

    • Alan says:

      @hussein, thanks for letting me know about this issue. This sounds like it’s most likely caused due to the encoding type I’m using in my code. I’ve selected Encoding.ASCII as the encoding when reading the data back from the report server. If you download the code from Github and modify the encoding to UTF8 (or some other encoding that would support your characters) then you can rebuild the dll and you should be all good.

      Alan

  9. Yow says:

    Hello Sir,
    Thanks for the library.
    I tried run your AlanJuden.MvcReportViewer.ExampleWebsite.NetCore and pointing to one of my report in local SQL Server Reporting Services but encountered the following error:
    MessageSecurityException: The HTTP request was forbidden with client authentication scheme ‘Negotiate’.

    May I know why ? How to fix this ?

    Regards,
    Yow

    • Alan says:

      @Yow, have you tried searching your error on google?

      It sounds like it’s just an authentication issue so I’m assuming the credentials you’re using on the ReportController are not valid in the context of your local SSRS instance. Double check the ReportController property for NetworkCredentials are valid credentials on your SSRS instance.

      Alan

  10. Yow says:

    Dear Sir,

    In the ReportController’s NetworkCredentials, I have tested the following options (the domain also tried IP address)
    return new System.Net.NetworkCredential(“administrator”, “abc*2017”, “LAPTOP-2AN7D2UF”);
    return System.Net.CredentialCache.DefaultNetworkCredentials;

    In the ReportController’s ReportServerUrl, i changed to (the domain also tried IP address):
    return “http://LAPTOP-2AN7D2UF:9000/Reports_SQLEXPRESS2016”;

    In the ReportController’s MyReport, i changed to:
    var model = this.GetReportViewerModel(Request);
    model.ReportPath = “/Billing/debitnote1”;
    model.AddParameter(“CustomerCode”, “”);

    In the ReportServiceHelper’s _initializeHttpBinding, i tried your default and also the following:
    basicHttpBinding.Security.Transport.ClientCredentialType = System.ServiceModel.HttpClientCredentialType.Ntlm;
    Also tried :
    var basicHttpBinding = new System.ServiceModel.BasicHttpBinding(System.ServiceModel.BasicHttpSecurityMode.None);

    I am using latest Windows 10 and install SQL Server 2016 with Native Reporting Services.
    In the Reporting Services, I have tried the following Service Account:
    Virtual Service Account
    Local System
    Network Service
    The Reporting Service Web Portal URL is working and can run the test report debitnote1 created from Report Builder

    I have opened up the firewall port for 80 and 9000 following the suggestion at:
    https://msdn.microsoft.com/en-us/library/bb934283.aspx

    I have tried the suggestion to configure registry at:
    http://developers.de/blogs/damir_dobric/archive/2009/08/28/authentication-problems-by-using-of-ntlm.aspx

    All the above attemos still failed, can you show me how to configure to connect without any security ?
    I just want to view the report.
    Do I miss out anything ?

    Regards,
    Yow

  11. Victor says:

    Hi Alan,

    Thanks for the project library!
    I’m trying to run the core project but getting the error:
    MessageSecurityException: The HTTP request was forbidden with client authentication scheme ‘Negotiate’.
    I tried the the default credentials and Custom Domain authentication and got same thing 🙁

    trowing the error before returning parameters for this method:

    public static ReportService.ReportParameter[] GetReportParameters(ReportViewerModel model, bool forRendering = false)
    {
    //var url = model.ServerUrl + ((model.ServerUrl.ToSafeString().EndsWith(“/”)) ? “” : “/”+ “ReportService2005.asmx”);

    var url = model.ServerUrl;

    var basicHttpBinding = _initializeHttpBinding();
    var service = new ReportService.ReportingService2005SoapClient(basicHttpBinding, new System.ServiceModel.EndpointAddress(url));

    service.ClientCredentials.Windows.AllowedImpersonationLevel = System.Security.Principal.TokenImpersonationLevel.Impersonation;
    service.ClientCredentials.Windows.ClientCredential = (System.Net.NetworkCredential)(model.Credentials ?? System.Net.CredentialCache.DefaultCredentials);

    string historyID = null;
    ReportService.ParameterValue[] values = null;
    ReportService.DataSourceCredentials[] rsCredentials = null;

    var parameters = service.GetReportParametersAsync(model.ReportPath, historyID, forRendering, values, rsCredentials).Result;

    return parameters;
    }
    Any suggestions will be appreciated! thanks again!

    • Alan says:

      @Victor,

      This sounds very much like an issue that someone else reported to me in email and they were able to get past the issue by editing the rsreportserver.config on their report server to include the following:

      < AuthenticationTypes >
      < RSWindowsNegotiate / >
      < RSWindowsNTLM / >
      < /AuthenticationTypes >

      *edit – to get the xml to show up properly in this comment (it was invisible)*

  12. Benjamin Harris says:

    Thanks for this code but I am getting the following error when trying to run it against our SSRS Server which is on a secure http (https) server.

    ArgumentException: The provided URI scheme ‘https’ is invalid; expected ‘http’.

    it throws it on the _initializeHttpBinding() method. I noticed that it is using BasicHttpBinding with the service model instead of BasicHttpsBinding. Is this all that needs to be changed to get it to work with https?

    Thanks for your help!
    Ben

    • Alan says:

      @Benjamin Harris,

      I haven’t tried connecting to a https url for report server as mine is not that way. I would assume your suggestion would work as expected.

      Alan

  13. Yow says:

    @Alan

    I have tested your suggestion to Victor, i.e.:

    it’s not working. It’s still showing the same error:
    MessageSecurityException: The HTTP request was forbidden with client authentication scheme ‘Negotiate’.

    Please help soonest possible

  14. Ryan says:

    Hi, thank you for this post, I am able to get your sample .NetCore project to render a local SSRS report just fine, but when trying it from our custom .NetCore app, I get the same security error as mentioned about. I have checked the creds are valid and the SSRS server is configured properly. Any suggestions?

    MessageSecurityException: The HTTP request was forbidden with client authentication scheme ‘Negotiate’.

    • Alan says:

      @Ryan, did you attempt the fix suggested in the comments above? Someone else with the same issue made a change to their report server config file and restarted the SSRS service and it was all good. Let me know what happens from that.

      Alan

  15. Ryan says:

    Thanks for the quick response. Yes I tried that and it did not resolve the issue. The odd thing is that it works fine with your example .NetCore website project to that same SSRS server. For some reason our client app seems to try and authenticate a different way to the same SSRS server. I’m going to try a fresh project today to see if I can figure out what is changing the authentication.

  16. Ryan says:

    Hi Alan, I got this to work. I had to set the HttpClientCredentialType.Ntlm and the HttpProxyCredentialType.None and then the error went away and the report now renders. Thanks again, this is great stuff and has saved us a lot of time making SSRS reports work with .Net Core.

    var binding = new system.ServiceModel.BasicHttpBinding(System.ServiceModel.BasicHttpSecurityMode.TransportCredentialOnly);
    binding.Security.Transport.ClientCredentialType = System.ServiceModel.HttpClientCredentialType.Ntlm;
    binding.Security.Transport.ProxyCredentialType = System.ServiceModel.HttpProxyCredentialType.None;
    binding.MaxReceivedMessageSize = int.MaxValue;

    return binding;

  17. Deyan says:

    Hi Alan,

    I’m not sure how you manage to generate these Reference.cs files but can I ask you to upload
    one more for the ReportService2010.asmx endpoint.

    Thanks

    • Alan says:

      @Deyan,

      What are you trying to do with the ReportService2010.asmx endpoint? This page explains the use of each of the endpoints: https://msdn.microsoft.com/en-us/library/ms155398.aspx

      I chose the ReportService2005.asmx endpoint because I figured it would be on the most report servers so it would work for the most people.

      Standard .NET Project Instructions for changing the web service path:
      1. Go to the AlanJuden.MvcReportViewer project.
      2. Navigate in the solution explorer to “Web References” in the root of the project.
      3. Expand the “Web References” folder.
      4. Click on each reference and change the “Web Referenc URL” (located in the properties window). Changing the path will force the file to be regenerated.

      .NETCore Instructions for changing the web service path:
      1. Install this plugin to your Visual Studio: https://marketplace.visualstudio.com/items?itemName=erikcai-MSFT.VisualStudioWCFConnectedService
      2. Go to the AlanJuden.MvcReportViewer.NetCore project.
      3. Right click the project and choose “Add” –> “Connected Service” and then choose the “WCF Service – Preview” option.
      4. Follow the instructions of the wizard.

      Hope this helps.

      Alan

  18. Ken says:

    Is there a way to do drill in reports?

  19. napoleon jones says:

    Is it possible it run this in local mode without an SSRS server?

    • Alan says:

      @napoleon, my project does not support local mode reports. It relies on having the report living in SSRS and communicating with the SSRS web service api.

  20. Paul says:

    First and foremost, thank you for this.

    If previously answered elsewhere, I apologize. We cannot display the div section “ParametersContainer”, as there are a few sensitive parameters that we cannot have clients alter. Is there any way to hide it?

    I’ve added $(‘.ParametersContainer’).addClass(‘hide’); to the ajax response in the viewReportPage function as a workaround.

    Any help would be greatly appreciated.

    • Alan says:

      @Paul, you should be able to “hide” the parameters from within the report designer that you used to design the report. My control will include them as hidden form fields if you do that.

  21. Paul says:

    Thank you for the quick response.

    Worked like a charm.

    Much appreciated. Have a great day.

  22. David says:

    Thank you for putting the effort in on this. Saved me a lot of work.

    I also encountered the 403 Forbidden issue with 2016 report server. I was able fix the issue by changing the authentication type in the resportserver.config to .

    Hope this helps.

    Thanks again!

  23. Bojan says:

    Hey Alan,

    Firstly i would like to thank you for your work on SSRS .net core app. I have tested it and it works excellent.
    Also i have managed to run local reports with changing extension to .rdl, and adding correct data source and data set for given SSRS Server.
    However, when i tried hosting that app in Linux environment i got PlatformNotSupportedException. Full stack trace can be found at: https://pastebin.com/nCgCeA8h
    Additional details:
    – SQL Server 2014 with SSRS on Windows 10, with inbound port 80 opened(ReportServer web service url can be accessed via link in Ubuntu).
    – Web app hosted on Ubuntu 16.04
    – I have changed credentials to use custom domain:
    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”, “domain”);
    }
    }
    Do you know if it can be fixed and what could be causing this?

    Thanks in advance,
    Bojan

    • Alan says:

      @Bojan, thanks for letting me know that everything is going well with the library. I believe that since you’ve turned your local report into an .rdl and put it on a server it’s no longer a local report any more. My library relies on having the server component there to use for requests.

      I haven’t had any chances to test out my library on Ubuntu yet and it’s a fun idea to try. From what it looks like, the logic that I’m using to communicate from .NetCore to the SSRS web services has issues (most likely not fully implemented on Ubuntu with .NetCore).

      Alan

  24. HS says:

    Hi Alan,
    Thanks for the introduction of the library.
    When I followed the steps, what I got was a blank page, with only the “ReportViewer” header shown up, nothing else. No error messages either.
    I was using standard .NET Framework. The report was running locally on an SSRS server The report ran fine both directly or through an aspx page.
    What went wrong? How should I debug? When I ran in debug mode, no breakage on any exceptions.

    Thanks a lot,
    HS

    • Alan says:

      @HS, seeing as how all of your links are local, would you mind sharing the link that you go to for your report on SSRS as well as the Report controller action method for calling into your report? That would help me to determine if maybe you’re using an incorrect path or something for your report.

  25. Dave says:

    Hi Alan,

    First off, great post. It’s very promising. However, I am getting an error trying to run mobile reports via the application.

    The operation you are attempting on item ‘/Mobile/Listings/Listings Active’ is not allowed for this item type. (rsWrongItemType)

    Are you experiencing this same issue?

    Thanks,

    Dave

  26. Pooja says:

    Hi,

    I am using grouping in my report but when i see the report on .NET Core web page it doesn’t show “plus” sign to expand group. Can you please help me with this ASAP ?

    Thanks

    • Alan says:

      @Pooja, I haven’t specifically added any logic to deal with the collapsible / expandable group sections on the reports. I’m not really sure it will be possible as I had looked into similar options around user sorting which is not supported through the API at all. I’ve added a Github issue to track progress on that question.

      https://github.com/alanjuden/MvcReportViewer/issues/33

      Alan

  27. Pooja says:

    the image in my report is not showing up in UI but when I export the report it shows.

    • Alan says:

      @Pooja, are you by chance using the ReportController property for UseCustomReportImagePath?

      I ran into this issue on my own server and here’s what’s really happening. The images were not accessible through the normal SSRS url that was passed back in the content of the report through the API. I had to enable the “UseCustomReportImagePath” property so that your website kind of behaves as a proxy to serve up the image from the report server. You should really only have to set that property to true and should see it working. The reason that you’re seeing the images in the export is because the images are embedded in the content that comes back rather than being links to the report server itself as they are when you view the report on the website (or if you export to HTML you would see the same issue).

      Hope this helps!

      Alan

  28. Pok says:

    Hello Alan.
    I can’t get past of the “negotiation scheme error ” i already added Authentication Ntls to the server pls help

    • Alan says:

      @Pok,

      I’m assuming that you’re using the .NetCore version. On your controller, you can override the “ClientCredentialType” property and specify it to be Ntlm like this:

      protected override System.ServiceModel.HttpClientCredentialType ClientCredentialType
      {
      get
      {
      return System.ServiceModel.HttpClientCredentialType.Ntlm;
      }
      }

  29. Cristian says:

    Hello,

    After two days of work in configuring the packages from Nuget, finally i can run my reports. I’m writing this because there are only few sites where i found some details about this problems.
    Here are the problems which challenged me:
    1. There was a Nuget Package, “System.ServiceModel.Http” which was missing. I install it from Nuget.
    2. Authentication problem, the one with Negotiate. After i made your setting in Report Services config, i wasn’t able to access the page, then i realized that i have other port than default. I modified the URL and than the page was loading but without data.
    3. My report controller name was “ReportsController”, and my Views folder was “Reports”, i had to rename both to “ReportController” and “Report”.

    There was some differences in this site and github, i made some changes from git, for View file scripts.
    Now i am happy. Thank you Alan!

  30. Thomas says:

    Hello,

    first it worked very well, but one question have i still
    is it normal if i put charts in the Report that anytime pop up a window to give in Credentials (username and Password ) ?
    If i put in teh Credentials it shows me than the Graphi , for example the PIE Diagramm

    Or have i forget something configure an the reportserver ? its a 2016 RS .

    And if i close the pop up window than it didnt show the Graphic piece from the Report, but in the Export for example Excel or PDF it shows .

    Thanks

  31. John says:

    I have been using the MVC work-round which involved using windows form to render report viewer. The advantage with it was that I create my own dataset without using report parameters, add it as data source to a report and then render the report.

    I can see your code passes your model AlanJuden.MvcReportViewer.ReportViewerModel to the view in this line
    return View(“ReportViewer”, model);

    Is it possible to pass my own model ? I do not need parameters because I can filter the data in my model.

    Thanks

    • Alan says:

      @John, Unfortunately you’ll have to pass my model because it lets the control know what path and settings to use when connecting to the SSRS api.

  32. Simon says:

    Hi Alan,

    Thank you very much for the great solution for SSRS. I was able to run your solution, and modified the credentials, serverurl, etc. to display one of my report successfully.

    Now, I am trying to incorporate your nuget package into my existing project. Added the nuget package successfully, but my issue is, I already have a ReportController which currently inheriting from another base class that our team has developed which provides localization, authentication services. Obviously, my report controller can not inherit from two base classes. What changes do you recommend to incorporate your work into my project or how do I go about doing it? Any thoughts or ideas, is truly appreciated.

    Thanks,
    Simon

  33. Simon says:

    Alan,

    Following up the above posting, I ended up creating another controller called SSRS, ReportViewer in SSRS folder under Views, added all the necessary css, js, lib files to my project and all works like a charm. I was hoping that I don’t have to modify your .NetCore library at all, so that future changes to your library will be automatically downloaded, but I think that is a wishful thinking on my part. For example, the list of export formats, is built into your helper class, and I would like to modify that list, etc. You have put in lot of hard work in this project Alan. Very impressive, useful since Microsoft dropped the ball on this. Thank you very much.

    Simon

    • Alan says:

      @Simon,

      Thanks for your response, I had intended to get back to you today. Sorry I’ve been super busy lately. That was going to be my suggestion as well for just naming it as a different controller name and then pointing your ReportViewer.cshtml links that are going to “/Report/” to go to your controller instead.

      Since you’re looking to hide some of the export methods, you could easily do this with some css. Each of the export menu items has a distinct css class. If you’re wanting to hide the “XML” export, then you can use:

      li>.ExportXml {
      display: none;
      visibility: hidden;
      height: 0;
      }

      Let me know if that works for you or not.

      Thanks,

      Alan

  34. Cristian says:

    Hello Alan,

    I’m using your library for displaying SSRS reports in an MVC application, but I need to integrate into my report special characters like ‘ț ș ă î â’, from Latin_1. Now, every character it’s replaced by ‘??’ characters in view page, but if I export it to PDF it works fine and displays special characters too. Where do I need to modify the Unicode in order to display those character in view?

    Thanks for the great job you’ve done!

    • Alan says:

      @Cristian, there is already a way available to override the Encoding.

      On the ReportController you can override it at a global level (for all your reports) by overriding the “Encoding” property…or you can set it individually on each report model if you have a lot of differences in Encoding by using the “Encoding” property on the model in your ReportController action methods.

      Hope this helps!

      Alan

  35. Mike says:

    Alan,

    Thank you so much for sharing your library. I am attempting to integrate your viewer into a .NET core application that uses Kendo widgets in the UI, and I’d like the report viewer controls (date picker, multi-select, etc) to have the same look-and-feel. I’m looking through the sample view you provided and am trying to determine what Select2 code needs to change. Can you advise?

    • Alan says:

      @Mike,

      Obviously you’ll want to include the Kendo UI JS library in your site, but from what I’m reading on the Kendo UI dropdownlist control, you should be able to just modify my ReportViewer.cshtml file and adjust the call to $(‘select’).select2(); to be $(‘select’).kendoDropDownList();

      Hope this helps!

      Alan

  36. Alex says:

    Hi guys.

    I have the same problem as Yow and Ryan.
    The HTTP request is unauthorized with client authentication scheme ‘Negotiate’

    Tried Rayn’s solution with proxy but it doesn’t make any difference.
    What interesting is that the same setup works with SSRS 2012 with no problem but not with SSRS 2016.
    Anyone aware about any difference between them? What else could it be?

    • Alan says:

      @Alex, I’m sorry that I’m just now getting to respond to you here. I haven’t really tested against SSRS 2016 yet due to not have one stood up anywhere yet to test against. I assume it should work fine though. That’s odd that a 2012 server works for you but not the 2016. I would look into the configuration of the SSRS server components to ensure that your user account that you’re setting in the ReportController.cs has acces to the server.

  37. John says:

    Alan,
    I cannot thank you enough for publishing this. After working with your code for the past 15 hours, I have it retrieving reports, (With images). Inside of my C# asp.net core project. This has been a huge life-saver. I cannot believe MS has dropped the ball on all of us who are working with SSRS. I have done the best I can to modify your code to fit inside my SPA application (even getting the reports vis web-api instead of routing through controllers)
    I have one comment though. It seems as if it executes the report during the generation of the controls. is there anyway to have the nav controls on the page (without the html-helpers) and then get the report parameters and reports separately? I think it would take a re-write of sorts, but might “perceive” the page being generated quicker.I will continue to look into this. Any plans for a future release?

    • Alan says:

      @John,

      Thanks for the kind words! I’m glad it’s working well for you mostly. The way I have handled the page loading quicker is by setting the AjaxLoadInitialReport property.


      //This would be in your specific controller action
      model.AjaxLoadInitialReport = false;

      //Or this would be on your ReportController.cs
      protected override bool AjaxLoadInitialReport
      {
      get { return false; }
      }

      Also, I’m looking into updating to .NetCore 2.0 just because there’s a lot of interest in that. I’ve been in the process of upgrading it in my (not much) spare time. Other than that, I haven’t been working on any new features to it really. I use it as is at my workplace and haven’t really needed anything additional.

      Alan

    • John says:

      Switching the AjaxLoaded flag does not seem to make much difference. if I read correctly, setting it to false simple loads the report at the same time as the controls. but if I defer (set to true) the report makes another call to load. So, the report loading is a bit quicker I suppose, however, I would like the controls to load quicker. It seems as if you are loading (executing) the report before generating the HTML for the controls. I suppose that’s to build the report parameters? I was thinking of hard typing the controls (first, next last ect) in the HTML of the page, and then just a simple AJAX call to get the report parameters. build them, display them along with the report? Although the reports only take 1-1.5 seconds to load anyway, so it might be a case of more work then needed.

      I am running it with .net core 2.0 but inside the standard framework (as my project needs specific references not used in core).

      I see someone forked your project and is doing something similar to me, in that its a SPA app and they are going though a web-api endpoint to get the reports HTML

  38. Eric J Lynch says:

    Hi Alan,

    Thank you for putting this together. I’m hoping you can help me get over these error messages. I got over one of them by installing the System.ServiceModel.Http from Nuget. Then I got errors from the _Layout view (it didn’t know how to deal with your AdditionalHeadContent and Content sections). So I copy/pasted your _Layout from your Net Core sample which accounted for those sections in ReportViewer.cshtml. But when I run it, I get Aggregate Exceptions on both @Html.RenderReportViewer(Model) and also @RenderSection(“Content”, false).

    I’m approaching the point where I can’t spend any more time trying to make this work. Any idea why it keeps blowing up? I’ve followed the instructions here exactly. Oh, and I”m using MVC Core 2, hitting a Northwind database on local SQL Server.

    • Alan says:

      @Eric J Lynch, unfortunately the .NetCore side of things is not my daily driver that I made for work. I haven’t run into the Aggregate exceptions on my examples. Perhaps a good place to start would be to run entirely from my sample .NetCore website and see where the differences are between your site and mine?

      Alan

      • Eric J Lynch says:

        No, I didn’t. No time to investigate any further, I’m afraid. In the interests of deadlines, I have to decide on a consistently working solution and get this project to production. I really wish this could have worked, but I’m going to have to go with a paid solution.

    • Ishikawa says:

      Hi Eric & Alan,

      First, thanks to Alan for providing this library, it may be very helpful for me in the future (whenever I make it work within my project) !
      Well, same issues here (System.ServiceModel.Http and exceptions related to @Html.RenderReportViewer(Model)). My project also uses MVC Core 2 latest (stable) build. I don’t have very much time for investigating on these issues neither (I’m working on a POC project)…

      @Eric : Did you manage to get the things work on your side ?

      Thanks

      • Ishikawa says:

        Hi,

        I have some updates to share. It was meant to be my last investigating day on this project, so I put all my resources on trying to solving the remaining issues… And I finally succeded :

        – System.ServiceModel.Http exception : I confirm that installing the latest version of the DLL from NuGet solves the issue.
        – System.Reflection.TypeExtensions (thrown on @Html.RenderReportViewer(Model) call) : Getting the latest version from NuGet also solves the problem.
        – “The HTTP request is unauthorized with client authentication scheme ‘Negotiate’. The authentication header received from the server was ‘NTLM’.” exception : first, when you set the NetworkCredential, you have to make sure that the domain is correct and that the specified user is correctly registered on the report server domain. Then, in your Action code (where the ViewModel is instanciated), you have to specify the ClientCredentialType property (in my case, NTLM).

        Well, I hope this will hope those who work with MVC Core 2.X ! In case my explanations aren’t clear enough, feel free to ask me questions.

  39. VSchimmiri says:

    Hello Allen,

    I am trying to port you solution to Angular 4, server being core 2.0, I am getting issues converting the JQuery to Type script, Is there any possibility that you can help me? Or putting a sample app for Core 2.0 and angular 4??

    Appreciate your help

    Thanks,
    VS.

  40. John says:

    Hello Allen,
    I have 2 questions for you.
    1) When I resize an embedded image in my report, (this works fine) but when I view it, the image seems to try and display normal size. Anyway the controls will “FitProportional” the image?
    2) How can I get specific CHARs to display? For example, inside my report this works,ChrW(&H221A) (CHECK BOX) but the report just displays “???”

    Thanks for much for putting this together. Still shocked MS has dropped the ball on this big time

    John

Leave a Reply

Your email address will not be published. Required fields are marked *