[英]SSRS report with .NET Core, The HTTP request is unauthorized with client authentication scheme 'Ntlm'
I'm trying to generate an SSRS report from .NET Core application and I'm following this tutorial我正在尝试从 .NET 核心应用程序生成 SSRS 报告,我正在关注本教程
But I'm getting the following exception但我收到以下异常
The HTTP request is unauthorized with client authentication scheme 'Ntlm'.
HTTP 请求未经客户端身份验证方案“Ntlm”的授权。 The authentication header received from the server was 'NTLM'.
从服务器收到的身份验证 header 是“NTLM”。
When I remove the credentials and use BasicHttpSecurityMode.None
with HttpClientCredentialType.None
everything is working fine but I need to add credentials to the service当我删除凭据并将
BasicHttpSecurityMode.None
与HttpClientCredentialType.None
一起使用时,一切正常,但我需要向服务添加凭据
I know there are many answers to this error but I've tried almost all of them but nothing is working for me我知道这个错误有很多答案,但我已经尝试了几乎所有的答案,但没有什么对我有用
Here is what I've tried:这是我尝试过的:
I tried to add ProxyCredentialType
to be Ntlm
but I got the same error我试图将
ProxyCredentialType
添加为Ntlm
但我得到了同样的错误
var binding = new BasicHttpBinding(BasicHttpSecurityMode.TransportCredentialOnly);
binding.Security.Transport.ProxyCredentialType = HttpProxyCredentialType.Ntlm;
binding.Security.Transport.ClientCredentialType = HttpClientCredentialType.Ntlm;
binding.MaxReceivedMessageSize = 10485760; //10MB limit
var rsExec = new ReportExecutionServiceSoapClient(binding, new EndpointAddress(SSRSReportExecutionUrl));
var clientCredentials = new NetworkCredential(SSRSUsername, SSRSPassword, ".");
if (rsExec.ClientCredentials != null)
{
rsExec.ClientCredentials.Windows.AllowedImpersonationLevel =System.Security.Principal.TokenImpersonationLevel.Impersonation;
rsExec.ClientCredentials.Windows.ClientCredential = clientCredentials;
}
Also I tried to replace HttpClientCredentialType.Ntlm
with HttpClientCredentialType.Windows
but I got this error我也尝试用
HttpClientCredentialType.Ntlm
替换HttpClientCredentialType.Windows
但我收到了这个错误
System.ServiceModel.Security.MessageSecurityException: The HTTP request is unauthorized with client authentication scheme 'Negotiate'.
System.ServiceModel.Security.MessageSecurityException:HTTP 请求未通过客户端身份验证方案“协商”进行授权。 The authentication header received from the server was 'NTLM'
从服务器收到的身份验证 header 是“NTLM”
Some answers suggest modifying web.config
file or using Microsoft Service Configuration Editor to edit it but I don't found this file or this editor in my case, I think these exist in .NET framework, not .NET core but I'm not sure一些答案建议修改
web.config
文件或使用 Microsoft 服务配置编辑器对其进行编辑,但在我的情况下我没有找到此文件或此编辑器,我认为这些存在于 .NET 框架中,而不是 Z303CB0EF9EDB9082D61BBBE5825D972 核心但不确定
Any idea what should I do to fix this error?知道我该怎么做才能解决此错误吗?
As far as I know, most of the cases on the web are deployed with IIS and verified using Windows Authentication.据我所知,web 上的大多数案例都是使用 IIS 部署的,并使用 Windows 身份验证进行验证。 If you're using IIS, only change the Windows Authentication enabled and try following the steps in this article .
如果您使用的是 IIS,只需更改启用 Windows 身份验证并尝试按照本文中的步骤操作。
If it doesn't work out, try using Kerberos and registering an SPN before using it.如果不起作用,请尝试使用 Kerberos 并在使用前注册 SPN。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.