2014-10-27 65 views
0

我正將部署在Azure SQL報表上的SSRS遷移到Azure虛擬機上託管的SSRS。我已經成功創建了一個虛擬機並部署了可從瀏覽器查看的報告。現在我的要求是我想以編程方式獲取PDF或EXCEL格式的報告。該需求量的工作罰款最後一年,但我搬到了VM當我打電話以編程方式在Azure虛擬機上託管SSRS

ReportViewer.ServerReport.GetParameters()

方法拋出異常401次未經授權的訪問。我目前使用下面的類來獲得驗證自己的用戶得到的PDF或Excel

public class SSRSReportServerCredentials : IReportServerCredentials 
{ 
     public SSRSReportServerCredentials() 
     { 
     } 

     public WindowsIdentity ImpersonationUser 
     { 
      get { return null; } 
     } 

     public ICredentials NetworkCredentials 
     { 
      get { return null; } 
     } 

     public bool GetFormsCredentials(out Cookie authCookie, out string user, out string password, out string authority) 
     { 
      authCookie = null; 
      user = sa; 
      password = test; 
      authority = SERVER.reporting.windows.net; 
      return true; 
     } 
    } 

報告任何一個可以幫助我解決我的問題,生產。

最好的問候, Zeeshan

回答

0

對不起你們太多遲到的回覆,我有固定的問題,近2個月前,但無法找到時間與大家分享我的發現。我有更改憑證文件,如下,並調用構造函數參數多

公共類SSRSReportServerCredentials:IReportServerCredentials { 公共SSRSReportServerCredentials(){ } 公共 的WindowsIdentity ImpersonationUser { {返回NULL; } } public ICredentials NetworkCredentials { get {return new NetworkCredential(WebConfigurationManager.AppSettings [「userName」],WebConfigurationManager.AppSettings [「password」]); } }

public bool GetFormsCredentials(out Cookie authCookie, out string user, out string password, out string authority) 
    { 
     authCookie = null; 
     user = null; 
     password = null; 
     authority = null; 
     return false; 
    } 
}