0

用 C#/WCF 编写 Web 服务客户端,无法让通道进行身份验证。这是我尝试执行 API 调用时收到的错误消息:

"Could not establish secure channel for SSL/TLS with authority 'www.redacted.com'."

和配置文件:

    <behaviors>
        <endpointBehaviors>
            <behavior name="NewBehavior0">
                <clientCredentials>
                    <clientCertificate findValue="th um bp ri nt va lu e  go es he re"
                        x509FindType="FindByThumbprint" />
                </clientCredentials>
            </behavior>
        </endpointBehaviors>
    </behaviors>
    <bindings>
        <basicHttpBinding>
            <binding name="WsApiServiceSoapBinding" closeTimeout="00:01:00" openTimeout="00:01:00" receiveTimeout="00:10:00" sendTimeout="00:01:00" allowCookies="false" bypassProxyOnLocal="false" hostNameComparisonMode="StrongWildcard" maxBufferSize="65536" maxBufferPoolSize="524288" maxReceivedMessageSize="65536" messageEncoding="Mtom" textEncoding="utf-8" transferMode="Buffered" useDefaultWebProxy="true">
                <readerQuotas maxDepth="32" maxStringContentLength="8192" maxArrayLength="16384" maxBytesPerRead="4096" maxNameTableCharCount="16384"/>
                <security mode="Transport">
                    <transport clientCredentialType="None" proxyCredentialType="None" realm=""/>
                    <message clientCredentialType="UserName" algorithmSuite="Default"/>
                </security>
            </binding>
        </basicHttpBinding>
    </bindings>
    <client>
        <endpoint address="https://www.<redacted>.com/services/WsApiService/"
            behaviorConfiguration="NewBehavior0" binding="basicHttpBinding"
            bindingConfiguration="WsApiServiceSoapBinding" contract="WsApiServicePortType"
            name="WsApiServicePort" />
    </client>

我在客户端代码中唯一要做的就是执行对 getDoc 方法的调用。代理类是从 WCF 下的 WSDL 自动生成的。我已验证证书已安装在 certmgr 的个人类别中,未过期,并且适用于所有目的。(我应该注意到,同样的证书在 WSE 下工作得很好。)我四处搜索,找不到任何与其当前配置相矛盾的东西。

有任何想法吗?如果您需要查看更多代码,请告诉我,我会尽快发布。

4

1 回答 1

0

好吧,在深入挖掘之后,我发现我使用了错误的指纹。我使用的证书属于同一颁发者的证书,但用于不同的端点(不知道我是如何混淆它们的)。现在我使用了正确的证书,我可以建立 SSL。

现在我只需要弄清楚为什么这个 MTOM 服务对我的 MTOM 请求感到惊讶:P

于 2013-06-14T18:05:19.730 回答