2014-10-27 71 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; 
    } 
}