我有一个SSRS(2008标准,而不是R2),所以我使用ReportExecution2005.asmx和ReportService2005.asmx来运行它们。尝试访问SQL Server报告服务的web服务时出现用户认证问题
我们开发了一个可以通过webservice连接到SSRS的应用程序。它在我们的测试服务器上运行良好,但是现在我试图在虚拟机上配置一个新的服务器,并且没有办法,每当应用程序尝试连接到SSRS Web服务时,我都会得到一个未受保护的401。
这很奇怪,因为如果我只将.asmx url放在客户端工作站上的firefox中,它会提示我输入用户名密码,我输入它并获得wsdl定义,所以我认为访问是正确的。
这里是我的代码:
public ReportGateway()
{
_rs = new ReportingService2005 { Credentials = new NetworkCredential(ConfigurationManager.AppSettings["ReportGatewayUser"], ConfigurationManager.AppSettings["ReportGatewayPassword"]) };
_rs.Url = "http://MyMachine:80/ReportServer/ReportService2005.asmx";//?? I saw when I was debugging that it wasn't reading the value in the app.config, but keeping the url of the reference when I created it, so for my test of the moment, I hard-setted it
_rsExec = new ReportExecution2005.ReportExecutionService { Credentials = new NetworkCredential(ConfigurationManager.AppSettings["ReportGatewayUser"], ConfigurationManager.AppSettings["ReportGatewayPassword"]) };
_rsExec.Url = "http://MyMachine:80/ReportServer/ReportExecution2005.asmx";//Same
GenerateReportList();
}
[MethodImpl(MethodImplOptions.Synchronized)]
private void GenerateReportList()
{
try
{
Dictionary<String, SRSSReport> reports = new Dictionary<String, SRSSReport>();
foreach (var children in _rs.ListChildren("/", true))
{
if (children.Type == ItemTypeEnum.Report)
{
SRSSReport report = new SRSSReport {Name = children.Name, Path = children.Path};
ReportParameter[] parameters = _rs.GetReportParameters(children.Path, null, false, null, null);
foreach (ReportParameter parameter in parameters)
report.Parameters.Add(new SRSSReportParameter {Name = parameter.Name, Type = _typeConverstion[parameter.Type]});
reports.Add(report.Path, report);
}
}
lock (_lockObject)
{
_reports = reports;
}
}catch(Exception ex)
{
_reports = new Dictionary<string, SRSSReport>();
Logger.Instance.Error("Error when contacting the reporting server", ex);
}
}
我完全地绝望了,现在,我已经在天找了一个解决方案,我不知道有什么我可以做错了。
你有一个想法/解决方案/ ...来帮助我吗?
非常感谢你,任何帮助将非常感激。
我知道,其实我认为我做了一个糟糕的配置。我删除了SRSS的所有用户并重新设置了它,并且它正在工作 – J4N