且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

针对 .NET Core 中的 ReportExecution2005.asmx 进行身份验证

更新时间:2023-11-30 23:24:52

在与这个问题斗争了一天之后,我发现了一种似乎有效的方法,通过使用唯一一个不会立即调用 ConfigureEndpoint 的构造函数,如题.如果我创建一个指定 NTLM 的绑定,并将该绑定与手动创建的端点一起传递,它会起作用:

After fighting with this for a day, I found an approach that seems to work, by using the only constructor that does not immediately call ConfigureEndpoint as pointed out in the question. If I create a binding that specifies NTLM, and I pass that binding along with a manually created endpoint, it works:

var binding = new BasicHttpBinding(BasicHttpSecurityMode.TransportCredentialOnly)
{
    Security =
    {
        Transport = new HttpTransportSecurity {ClientCredentialType = HttpClientCredentialType.Ntlm}
    }
};

var reportService = new CssbiReportService.ReportExecutionServiceSoapClient(binding,
    new EndpointAddress("http://myserver/ReportServer/ReportExecution2005.asmx"));

这在 .NET Core 中对我有用.

This is working for me in .NET Core.