2011-05-30 106 views
0

我是SSRS的新手,我开发了一些在Web框架中运行SSRS的报告。我的本地电脑上一切正常,工作正常。但现在我想将这些报告和新页面移动到Web服务器。我设法让它在Web服务器上运行,但出于某种原因,我认为必须在SQL Server 2008 SSRS上进行配置设置,每次运行报告时都会要求我为数据源指定用户名和密码。SSRS - 登录错误

该报表在网页框架中运行,该页面是在ASP.NET中开发的,我将页面上选定的参数传递给报表以生成报表。

我会在这里附图来说明我所得到的。这可能是我错过的一件非常愚蠢的事情。但任何帮助将不胜感激。
SSRS Error on webpage

回答

1

凭证是关于数据源中,我曾与SSRS一点点,我记得你可以设置数据源时设置验证类型。

Here你可以找到有用的信息。

+0

谢谢。我使用这个链接修复了它 – Rup 2011-05-30 12:12:03

0

我一直在我的项目上使用此代码,它的工作原理。首先,您必须创建实现IReportServerCredentials intefrace的自定义凭证类。

public class ReportServerCredentials : Microsoft.Reporting.WebForms.IReportServerCredentials 
{ 
    #region private members 

    private string _username; 
    private string _password; 
    private string _domain; 

    #endregion 

    #region Constructor 


    /// <summary> 
    /// Initializes itself with ReportServerUsername, ReportServerPassword and ReportServerDomain settings from web.config 
    /// </summary> 
    public ReportServerCredentials() 
    { 
     this._username = "USERNAME"; 
     this._password = "PASSWORD"; 
     this._domain = ""; // set if its domain server 
    } 

    public ReportServerCredentials(string username, string password, string domain) 
    { 
     this._username = username; 
     this._password = password; 
     this._domain = domain; 
    } 

    #endregion 

    #region IReportServerCredentials Members 

    public bool GetFormsCredentials(out System.Net.Cookie authCookie, out string userName, out string password, out string authority) 
    { 
     authCookie = null; 
     userName = password = authority = null; 
     return false; 
    } 

    public System.Security.Principal.WindowsIdentity ImpersonationUser 
    { 
     get { return null; } 
    } 

    /// <summary> 
    /// Creates a System.Net.NetworkCredential object with the specified username, password and domain. 
    /// </summary> 
    public System.Net.ICredentials NetworkCredentials 
    { 
     get { return new System.Net.NetworkCredential(_username, _password, _domain); } 
    } 

    #endregion 
} 

在显示它之前提供报告的凭据。

ReportParameter[] param = new ReportParameter[0]; 

protected void Page_Load(object sender, EventArgs e) 
{ 
    this.ReportViewer1.Reset(); 
    this.ReportViewer1.ServerReport.ReportServerUrl = 
      new System.Uri(ConfigurationManager.AppSettings["ReportServerUrl"]); // reads report server url from config file 
    IReportServerCredentials customCred = 
      new ReportServerCredentials(); //reads the username, password and domain from web.config 
    this.ReportViewer1.ServerReport.ReportServerCredentials = customCred; 

    this.ReportViewer1.ServerReport.ReportPath = 
     "/PATH_TO_SOME_REPORT"; // TODO: Put some real report path 

    this.ReportViewer1.ServerReport.SetParameters(param); // this will initialize report 
} 
+0

其实我试过这样做,但我仍然得到同样的问题。我以正确的方式连接到服务器,但在显示来自数据库的数据之前,它要求我提供凭据。 SQL服务器凭证...任何其他建议将不胜感激。 – Rup 2011-05-30 11:18:43