我之前设置了一个应用程序来使用ReportExecutionServiceSoapClient连接到SSRS并运行报告,但是由于实现了自定义的安全扩展,我不能再连接了。这是我一直在尝试的。我一直收到500个错误。我可以很好地登录到报告管理器,但是API不工作。
ReportExecution.ReportExecutionServiceSoapClient rsExec = new ReportExecution.ReportExecutionServiceSoapClient();
rsExec.ClientCredentials.UserName.UserName = "username";
rsExec.ClientCredentials.UserName.Password = "password";
byte[] results = null;
TrustedUserHeader trusteduserHeader = new TrustedUserHeader();
ExecutionInfo execInfo = new ExecutionInfo();
ExecutionHeader execHeader = new ExecutionHeader();
// Load the report
string reportPath = selReport.Path;
string historyID = null;
ServerInfoHeader serviceInfo = new ServerInfoHeader();
rsExec.LoadReport(trusteduserHeader, reportPath, historyID, out serviceInfo, out execInfo);
这是我的Web.config
<system.serviceModel>
<bindings>
<basicHttpBinding>
<binding name="ReportingService2010Soap" />
<binding name="ReportExecutionServiceSoap" />
</basicHttpBinding>
</bindings>
<client>
<endpoint address="REMOVED/ReportServer/ReportExecution2005.asmx"
binding="basicHttpBinding" bindingConfiguration="ReportExecutionServiceSoap"
contract="ReportExecution.ReportExecutionServiceSoap" name="ReportExecutionServiceSoap" />
<endpoint address="REMOVED/ReportServer/ReportService2010.asmx"
binding="basicHttpBinding" bindingConfiguration="ReportingService2010Soap"
contract="ReportService.ReportingService2010Soap" name="ReportingService2010Soap" />
</client>
“{”远程服务器返回错误:(500)内部服务器错误。“}”
这个错误发生在loadreport调用中。唯一阻止它工作的更改是身份验证。我添加了两行用户名和密码,并删除了这两行
rsExec.ClientCredentials.Windows.ClientCredential = (System.Net.NetworkCredential)System.Net.CredentialCache.DefaultCredentials;
rsExec.ClientCredentials.Windows.AllowedImpersonationLevel = System.Security.Principal.TokenImpersonationLevel.Impersonation;
可以不使用自定义身份验证来连接API吗?这就是我如何将SSRS改为自定义身份验证http://www.codeproject.com/Articles/675943/SSRS-Forms-Authentication的方式。
任何帮助都将不胜感激。我总是找不到,到处搜索。
发布于 2017-06-24 07:24:50
这对我很有效:
System.Net.NetworkCredential clientCredentials = new System.Net.NetworkCredential(ReportServerUserName, ReportServerPassword);
rsExec.Credentials = clientCredentials;
https://stackoverflow.com/questions/29721009
复制相似问题