.net core 通过WCF的SQL Server报表服务器(SSRS):HTTP请求未经客户端身份验证方案授权';Ntlm&x27;
我有一个.Net Core 3.1应用程序,它试图通过WCF连接到SQL Server报表服务器,以便按需编程生成报表 但是程序无法针对报表服务器进行身份验证 以下是相关的程序代码:.net core 通过WCF的SQL Server报表服务器(SSRS):HTTP请求未经客户端身份验证方案授权';Ntlm&x27;,.net-core,reporting-services,ssrs-2008,ssrs-2012,wcf-security,.net Core,Reporting Services,Ssrs 2008,Ssrs 2012,Wcf Security,我有一个.Net Core 3.1应用程序,它试图通过WCF连接到SQL Server报表服务器,以便按需编程生成报表 但是程序无法针对报表服务器进行身份验证 以下是相关的程序代码: var binding = new BasicHttpBinding(BasicHttpSecurityMode.TransportCredentialOnly); binding.Security.Transport.ClientCredentialType = HttpClientCredentialType.
var binding = new BasicHttpBinding(BasicHttpSecurityMode.TransportCredentialOnly);
binding.Security.Transport.ClientCredentialType = HttpClientCredentialType.Ntlm;
binding.MaxReceivedMessageSize = 10485760; //10MB limit
// Create the execution service SOAP Client
var rsExec = new ReportExecutionServiceSoapClient(
binding,
new EndpointAddress("http://my-ssrs/ReportServer")
);
// Setup access credentials.
var clientCredentials = new NetworkCredential(
"MyReportServerUserName",
"MyReportServerPassword",
"."
);
if (rsExec.ClientCredentials != null)
{
rsExec.ClientCredentials.Windows.AllowedImpersonationLevel =
System.Security.Principal.TokenImpersonationLevel.Impersonation;
rsExec.ClientCredentials.Windows.ClientCredential = clientCredentials;
}
// ************************************************
// Get following Exception when next line executes.
// ************************************************
await rsExec.LoadReportAsync(null, "/path-to/my-report", null);
当执行最后一行(“rsExec.LoadReportAsync”)时,我得到以下异常:
The HTTP request is unauthorized with client authentication scheme 'Ntlm'. The authentication header received from the server was 'NTLM'.
报表服务器位于同一Windows域上
经过一些研究,我尝试更改ClientCredentialType=HttpClientCredentialType.Windows,但这产生了一个不同的异常,如下所示:
The HTTP request is unauthorized with client authentication scheme 'Negotiate'. The authentication header received from the server was 'NTLM'.
有人对我的尝试有什么建议吗?此链接可能会帮助您: