我正在尝试将报告名称从 SSRS 服务器读取到列表中。我已经毫无问题地创建了 Web 引用,并且可以通过 IE 访问 Web 服务。
我收到 503 错误:执行代码时服务器不可用。我认为这可能是权限问题,但使用管理员凭据无济于事。异常发生在“items = service.ListChildren("/BRADS", true) 行。
ReportService.ReportingService2005 service;
public ReportsRepository()
{
service = new ReportService.ReportingService2005();
//string rptUserID = ConfigurationManager.AppSettings["rptUser"];
//string rptPassword = ConfigurationManager.AppSettings["rptPwd"];
//System.Net.NetworkCredential cred = new System.Net.NetworkCredential(rptUserID, rptPassword);
//service.Credentials = cred;
service.Credentials = System.Net.CredentialCache.DefaultCredentials;
}
IEnumerable<DataModels.ReportingService> IReportsRepository.GetReports()
{
CatalogItem[] items;
DataModels.ReportingService rpt = null;
List<DataModels.ReportingService> lstReports = null;
try
{
items = service.ListChildren("/BRADS", true);
if (items != null)
{
lstReports = new List<DataModels.ReportingService>();
foreach (CatalogItem item in items)
{
if (item.HiddenSpecified == false && item.Type == ItemTypeEnum.Report)
{
rpt = new DataModels.ReportingService();
rpt.ReportName = item.Name;
rpt.ReportPath = item.Path;
rpt.Category = item.Description;
}
lstReports.Add(rpt);
}
}
}
catch (Exception ex)
{
throw ex;
}
return lstReports;
任何想法将不胜感激。谢谢你。