2011-05-30 130 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