调用SSRS报告服务器,它询问“需要身份验证”窗口

时间:2012-07-13 06:53:05

标签: ssrs-2008 reportviewer reporting-services report-viewer2010

我刚刚开始使用SSRS,我遇到了一个非常奇怪的问题,即当我调用报表服务器URL时,即localhost / Reports

此URL需要用户名和密码的验证窗口。像这样。 enter image description here

如果我在这种情况下提交了本地系统用户帐户信息,它将显示我想要的报告服务器屏幕。像这样。 enter image description here

我创建了一个演示网络应用程序,在default.aspx页面中,我使用ReportViewer来显示报告并对其进行配置。这是我正在使用的代码 Default.aspx页面

<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班级

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;
        }
    }

在我运行这个网络应用程序时,它会给我一个错误,即 enter image description here

请帮我解决这些问题......

3 个答案:

答案 0 :(得分:1)

经过很长时间的研发,我得到了一个解决方案。我使用错误的SSRS服务URL。我使用的是localhost/Reports,但实际上SSRS报告服务器网址是localhost/ReportServer。因此,通过使用这个新的Reporting Service URL,我得到了该问题的解决方案。

答案 1 :(得分:1)

在localhost / Reports上单击您的报告,然后转到该报告的属性。在右侧,点击“数据源”。然后将单选按钮“凭据安全地存储在报表服务器中”,这里需要指定SQL服务器凭据,即用户名和密码

答案 2 :(得分:0)

一次性活动:点击报告后,它会再次询问用户名和密码,以克服以下指南。

(i)打开Internet Explorer,转到设置点击互联网选项

(ii)前往安全: - &gt;本地内联网 - &gt;点击网站

(iii)单击“高级”:

(iv)添加站点:ServerIP Addr(ex.172.16.2.224或localhost),然后关闭。

相关问题