简体   繁体   English

如何验证到报表服务器Web服务?

[英]How to authenticate into a Report Server Web Service?

I've installed SSRS 2017 locally. 我在本地安装了SSRS 2017。 I'm trying to call Web Service with auto-generated SOAP client in VS2015 (which can be outdated, but I have no choice): 我试图在VS2015中使用自动生成的SOAP客户端调用Web Service(可以过时,但是我别无选择):

var cl = new ReportingService2010SoapClient();
cl.ClientCredentials.Windows.ClientCredential = CredentialCache.DefaultNetworkCredentials;
CatalogItem[] catalogItems;
var res = cl.ListChildren(new TrustedUserHeader {}, "/", false, out catalogItems);

The result is an exception below: 结果是以下异常:

System.ServiceModel.Security.MessageSecurityException occurred 发生System.ServiceModel.Security.MessageSecurityException
HResult=-2146233087 Message=The HTTP request is unauthorized with client authentication scheme 'Anonymous'. HResult = -2146233087消息= HTTP请求未经客户端身份验证方案“匿名”授权。 The authentication header received from the server was 'NTLM'. 从服务器收到的身份验证标头是“ NTLM”。 Source=mscorlib 来源= mscorlib

I understand that my authentication attempt is incomplete, but I'm reading docs and examples for a while with no result. 我了解我的身份验证尝试尚未完成,但是我正在阅读文档和示例一段时间,但没有结果。

Related docs: 相关文档:

UPDATE : Also, I want to avoid messing with user name / password and want to re-use Windows mechanisms. 更新 :另外,我想避免弄乱用户名/密码,并想重新使用Windows机制。

Are you first time configuring WCF client? 您是第一次配置WCF客户端吗? Use Microsoft Service Configuration Editor (in VS: Tools > WCF Service Configuration Editor)! 使用Microsoft服务配置编辑器(在VS:工具> WCF服务配置编辑器中)!

With tool it was easy: 使用工具很容易:

<basicHttpBinding>
    <binding name="ReportingService2010Soap">
        <security mode="TransportWithMessageCredential">
            <transport clientCredentialType="Ntlm" />
        </security>
    </binding>
</basicHttpBinding>

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM