
// Instantiate the Soap clIEnt ReportExecutionServiceSoap rsExec = new ReportExecutionServiceSoapClIEnt(ReportExecutionServiceSoapClIEnt.EndpointConfiguration.ReportExecutionServiceSoap); // Create a network credential object with the appropriate username and password used // to access the SSRS web service string historyID = null; TrustedUserheader trustedUserheader = new TrustedUserheader(); Executionheader execheader = new Executionheader(); // Here we call the async LoadReport() method using the "await" keyword,which means any code below this method // will not execute until the result from the LoadReportAsync task is returned var taskLoadReport = rsExec.LoadReportAsync(reportPath,historyID); // By the time the LoadReportAsync task is returned successfully,its "executionInfo" property // would have already been populated. Now the remaining code in this main thread will resume executing string deviceInfo = null; string format = "EXCEL"; // Now,similar to the above task,we will call the RenderAsync() method and await its result var taskRender = await rsExec.RenderAsync(renderReq);
当它的组织renderAsync全部崩溃,因为服务的凭证没有在任何地方设置.我试图登录异步没有成功.此外,我尝试使用SetExecutionCredentialsAsync设置凭据,但我得到并且错误地说“http请求未经授权使用客户端身份验证方案’匿名’.从服务器收到的身份验证标头是’NTLM’.”我不知道如何为ReportExecutionServiceSoapClIEnt更改它.
我已经阅读了一些帖子,其中微软的人说用肥皂的身份验证没有解决,但对我来说似乎是如此接近真实.我觉得我错过了什么.
技术堆栈:VS 2017,.net核心web API,ssrs 2016,sql server 2016标准
如何对此呼叫的用户进行身份验证?
解决方法 我知道这是一个古老的问题,但我有同样的问题,偶然发现了答案.创建ReportExecutionServiceSoap对象后,您可以在ClIEntCredentials中指定用户名和密码.我使用Basic客户端凭证类型获得了成功.请确保您使用的是httpS,否则您的密码将以明文形式发送到报告服务器.我还建议将用户/密码存储在安全的地方而不是代码.
BasichttpBinding rsBinding = new BasichttpBinding();rsBinding.Security.Mode = BasichttpSecurityMode.TransportCredentialOnly;rsBinding.Security.Transport.ClIEntCredentialType = httpClIEntCredentialType.Basic;EndpointAddress rsEndpointAddress = new EndpointAddress("https://servername/reportserver/ReportExecution2005.asmx");var rsExec = new ReportExecutionServiceSoapClIEnt(rsBinding,rsEndpointAddress);rsExec.ClIEntCredentials.Username.Username = "username";rsExec.ClIEntCredentials.Username.Password = "pass"; 总结 以上是内存溢出为你收集整理的wcf – .Net Core ReportExecutionServiceSoapClient设置凭据全部内容,希望文章能够帮你解决wcf – .Net Core ReportExecutionServiceSoapClient设置凭据所遇到的程序开发问题。
如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。
欢迎分享,转载请注明来源:内存溢出
微信扫一扫
支付宝扫一扫
评论列表(0条)