0

In my mvc project reports are deployed on separate SSRS server and we are loading the SSRS Reports with help of iframe, problem with this is its asking for user name and password while accessing the reports with iframes. To remove the user id ans password prompt I was trying to implement the solution provided on this link and I changed the code in ReportTemplate.aspx.cs file as below to send the credentials referring this link:

    rvSiteMapping.Width = 800;
    rvSiteMapping.Height = 600;
    rvSiteMapping.ProcessingMode = ProcessingMode.Remote;
    IReportServerCredentials irsc = new CustomReportCredentials(@"userid", "password", @"\");
    rvSiteMapping.ServerReport.ReportServerCredentials = irsc;
    rvSiteMapping.ShowCredentialPrompts = true;
    rvSiteMapping.ServerReport.ReportServerUrl = new Uri("http://12.25.2.24/Reports");
    rvSiteMapping.ServerReport.ReportPath = "/report/AssetDetail";
    rvSiteMapping.ServerReport.Refresh();

I am getting below error:

The underlying connection was closed: An unexpected error occurred on a send. Unable to read data from the transport connection: An existing connection was forcibly closed by the remote host. An existing connection was forcibly closed by the remote host

However its working perfectly fine with below code:

    rvSiteMapping.Width = 800;
    rvSiteMapping.Height = 600;
    rvSiteMapping.ProcessingMode = ProcessingMode.Local;
    ReportsDataSet ds = new ReportsDataSet();
    var connectionString = ConfigurationManager.ConnectionStrings["LowryATS_Tenant2ConnectionString"].ConnectionString;
    SqlConnection conx = new SqlConnection(connectionString);
    SqlDataAdapter adp = new SqlDataAdapter("SELECT * FROM Assets", conx);

    adp.Fill(ds, ds.Assets.TableName);

    rvSiteMapping.LocalReport.ReportPath = Request.MapPath(Request.ApplicationPath) + @"AssetReport.rdlc";
    rvSiteMapping.LocalReport.DataSources.Add(new ReportDataSource("ReportsDataSet", ds.Tables[0]));

Can anybody please help me with this problem. We are using ssrs 2016 on ssrs server.

Yashpal S
  • 299
  • 4
  • 16
  • Can you get the SSRS log and see if the error can be found there. If the related error is not in the SSRS log then you can rule out SSRS and move on to other network access points. To me, It sounds like this is a sql server connection issue. Make sure the SSRS server can make a connection to your database. – Ross Bush Jun 18 '18 at 13:11
  • Hi @Ross Bush thanks for reply. I checked the SSRS Log but nothing is getting logged into that. However if I run the report from browser url after entering the credentials its working fine. – Yashpal S Jun 18 '18 at 13:36
  • Do you have a way to verify that you SSRS instance has access to the DB specified in LowryATS_Tenant2ConnectionString? – Ross Bush Jun 18 '18 at 13:43
  • Hi @Ross Bush LowryATS_Tenant2ConnectionString example I have given to explain that its working with local reports not with server report – Yashpal S Jun 19 '18 at 01:58
  • Normally you either use a shared data source or set the credentials in the report properties on the server. I've never tried doing it through code. – StevenWhite Jun 19 '18 at 15:44
  • Hi @StevenWhite, Initially I have deployed the reports on SSRS server and using the urls to view the reports but it was asking for windows credentials to render the reports, to remove that I am trying to load the server reports using report viewer and passing the windows credentials but its not working and throwing the error – Yashpal S Jun 21 '18 at 02:53
  • Again, I would recommend storing the credentials in the report settings on the report server. I believe that is how it is intended to be used. – StevenWhite Jun 21 '18 at 17:20

0 Answers0