WCF身份验证错误

我正在访问第三方WCF服务(我无权访问服务配置)我们正在使用SSL证书进行身份验证。

尝试访问任何提供的方法时遇到此错误

HTTP请求未经客户端身份验证方案“协商”授权。 从服务器收到的验证头是'Negotiate,NTLM

我查了很多谷歌链接,至今没有运气 - 不知道还有什么要检查的。

编辑

这是配置

<system.serviceModel>
        <bindings>
            <wsHttpBinding>
                <binding name="wsHttpBinding" closeTimeout="00:01:00" openTimeout="00:01:00"
                    receiveTimeout="00:10:00" sendTimeout="00:01:00" bypassProxyOnLocal="false"
                    transactionFlow="false" hostNameComparisonMode="StrongWildcard"
                    maxBufferPoolSize="524288" maxReceivedMessageSize="65536"
                    messageEncoding="Text" textEncoding="utf-8" useDefaultWebProxy="true"
                    allowCookies="false">
                    <readerQuotas maxDepth="32" maxStringContentLength="8192" maxArrayLength="16384"
                        maxBytesPerRead="4096" maxNameTableCharCount="16384" />
                    <reliableSession ordered="true" inactivityTimeout="00:10:00"
                        enabled="false" />
                    <security mode="Transport">
                        <transport clientCredentialType="Windows" proxyCredentialType="None"
                            realm="" />
                        <message clientCredentialType="Windows" negotiateServiceCredential="true"
                            establishSecurityContext="true" />
                    </security>
                </binding>
            </wsHttpBinding>
        </bindings>
      <client>
          <endpoint address="https://url"
              binding="wsHttpBinding" bindingConfiguration="wsHttpBinding"
              contract="IApiWS" name="wsHttpBinding">
          </endpoint>
      </client>
</system.serviceModel>

尝试将clientCredentialType="Windows"clientCredentialType="Certificate"我通常使用硬编码的WCF配置,而不是配置文件,所以我对此不太确定,但无论如何,请查看以下链接:选择MSDN上的凭据类型。

祝你好运。 我很惊讶你连接到什么/没有给出明确的端点连接指示,但是,嘿,你在处理第三方的东西时处理各种问题。


好吧,这可能有点含糊,所以我提前默认,本质上服务器告诉你你没有被授权,通常为此你会在你生成的代理上添加如下所示的内容

svc.ClientCredentials.Windows.AllowedImpersonationLevel = System.Security.Principal.TokenImpersonationLevel.Impersonation;

其中svc是您生成的代理。 我也在一个配置错误的IIS托管端点上看到了这一点,虚拟文件​​夹没有允许匿名设置(尽管你说你不能访问服务配置,因此可能不会有帮助)。 希望这可以帮助

编辑添加更多信息,

根据安全性的不同,类似于以下的设置可能更有用

svc.ClientCredentials.Windows.AllowedImpersonationLevel = System.Security.Principal.TokenImpersonationLevel.Anonymous;

编辑2上面的配置显示您正在使用的wsHttpBinding将Windows设置为clientCredentialtype以用于传输安全性和用户身份验证,这意味着您将通过当前登录的用户的凭据发送到使用NTLM进行身份验证的服务(如negotiateServiceCredentials是真实的)您是否确认登录的用户拥有该服务的权限?

链接地址: http://www.djcxy.com/p/95923.html

上一篇: WCF Authentication Error

下一篇: "ClickOnce does not support the request execution level 'requireAdministrator.'"