Calling SSRS Report Server it asked “Authenticatio

2020-04-19 05:55发布

问题:

I have just started working in SSRS and I got a very strange problem i.e. When I am calling report server URL i.e. localhost/Reports

This URL requires Authentication window for Username and password. like this.

If I submitted local system user account information in that case it will appear me report server screen which we want. like this.

I have created a demo web-application and in the default.aspx page I am using ReportViewer to show report and configure it. here is the code which i am using Default.aspx Page

<rsweb:ReportViewer ID="ReportViewer1" runat="server" Width="100%">
</rsweb:ReportViewer>

Default.aspx.cs Page

    ReportViewer1.ProcessingMode = ProcessingMode.Remote;
    IReportServerCredentials irsc = new CustomReportCredentials("username", "password", "India");
    ReportViewer1.ServerReport.ReportServerCredentials = irsc;
    ReportViewer1.ServerReport.ReportServerUrl = new Uri("http://localhost/Reports");
    ReportViewer1.ServerReport.ReportPath = "/SSRS_Demo/Report_CaseMain";
    ReportViewer1.ServerReport.Refresh(); 

CustomReportCredentials.cs Class

public class CustomReportCredentials : IReportServerCredentials
    {
        // local variable for network credential.
        private string _UserName;
        private string _PassWord;
        private string _DomainName;
        public CustomReportCredentials(string UserName, string PassWord, string DomainName)
        {
            _UserName = UserName;
            _PassWord = PassWord;
            _DomainName = DomainName;
        }
        public WindowsIdentity ImpersonationUser
        {
            get
            {
                return null;  // not use ImpersonationUser
            }
        }
        public ICredentials NetworkCredentials
        {
            get
            {
                // use NetworkCredentials
                return new NetworkCredential(_UserName, _PassWord, _DomainName);
            }
        }
        public bool GetFormsCredentials(out Cookie authCookie, out string user, out string password, out string authority)
        {
            // not use FormsCredentials unless you have implements a custom autentication.
            authCookie = null;
            user = password = authority = null;
            return false;
        }
    }

And while i am running this web-application in that case it will gives me an error i.e.

Please help me out what will I do to resolve these all errors.....

回答1:

After very long R&D I got a solution. I am using wrong SSRS service URL. I am using localhost/Reports but actually the SSRS Reporting Server URL is localhost/ReportServer. So by using this new Reporting Service URL i got the solution of that problem.



回答2:

Click on your report on localhost/Reports then goto property of that report. On right hand side there is 'Data Source' click on that. Then chek the radio button 'Credentials stored securely in the report server', here you need to specify your SQL server credentials i.e. User name and password



回答3:

One Time Activity: Once you click on report it will ask again the username and password first time, to overcome this follow below guidelines.

(i) Open Internet Explorer go to Setting click on Internet options

(ii) Go to Security :-> Local Intranet -> Click on Sites

(iii) Click Advanced:

(iv) Add Site: ServerIP Addr (ex.172.16.2.224 or localhost) and then Close.