2012-10-02 29 views
2

我的報告服務器上運行的SSRS 2008 R2報告。當我訪問使用報表管理器或Web服務URL報告它工作正常。SSRS與ASP.net的ReportViewer rsAccessDenied

http://mycomputer/ReportServer 

http://mycomputer/Reports 

當我添加的ReportViewer到WebForms的網站,並將其與報告路徑,我的報告指出

http://mycomputer/reportserver 

它給了我一個拒絕訪問錯誤運行該網站在使用VS.net的Web服務器。

授予用戶'mycomputer \ myusername'的權限不足以執行此操作。 (rsAccessDenied)

以下是我在aspx頁面中使用的確切代碼。

<asp:ScriptManager ID="ScriptManager1" runat="server"> 
</asp:ScriptManager> 
<rsweb:ReportViewer ID="ReportViewer1" runat="server" ProcessingMode="Remote" Font-Names="Verdana" 
    Font-Size="8pt" InteractiveDeviceInfos="(Collection)" WaitMessageFont-Names="Verdana" 
    WaitMessageFont-Size="14pt" Width="712px"> 
    <ServerReport ReportPath="/MyReports" ReportServerUrl="http://mycomputer/reportserver" /> 
</rsweb:ReportViewer> 

mycomputer \ myusername是機器上的管理員。我還添加了其作爲ReportManager的管理員。

我在管理員模式下使用IE運行它。

還有什麼可能導致訪問被拒絕的問題?

我已經讀過其他有問題的人,但其中大部分都不適用於2008R2,所以我一直無法弄清楚如何嘗試他們所做的。沒有IIS配置並沒有IUSR授予訪問權限的報告。

SSRS日誌只顯示相同的錯誤消息,沒有任何其他信息。

回答

2

創建實現IReportServerCredentials的實例類應該可以解決問題。添加下面的類並調用它,如下所示:

ReportViewer1.ServerReport.ReportServerCredentials = new ReportServerCredentials("username", "pwd", "domain"); 

/// <summary> 
/// Local implementation of IReportServerCredentials 
/// </summary> 
public class ReportServerCredentials : IReportServerCredentials 
{ 
    private string _userName; 
    private string _password; 
    private string _domain; 

    public ReportServerCredentials(string userName, string password, string domain) 
    { 
     _userName = userName; 
     _password = password; 
     _domain = domain; 
    } 

    public WindowsIdentity ImpersonationUser 
    { 
     get 
     { 
      // Use default identity. 
      return null; 
     } 
    } 

    public ICredentials NetworkCredentials 
    { 
     get 
     { 
      // Use default identity. 
      return new NetworkCredential(_userName, _password, _domain); 
     } 
    } 

    public bool GetFormsCredentials(out Cookie authCookie, out string user, out string password, out string authority) 
    { 
     // Do not use forms credentials to authenticate. 
     authCookie = null; 
     user = password = authority = null; 
     return false; 
    } 
} 

感謝菲爾Clewes:link

+1

我的錯,如果你使用的ReportExecutionService你可以使用的NetworkCredential,更新了答案 –

相關問題