另一个 - HTTP请求是未经授权的错误

时间:2009-09-11 14:28:18

标签: wcf

每当我尝试通过WCF使用我的Web服务时,都会收到此错误:

The HTTP request is unauthorized with client authentication scheme 'Negotiate'. The authentication header received from the server was 'Negotiate,NTLMnProviders'.

我知道我为此环境正确设置了Kerberos(它调用了我在其他应用程序中使用的SharePoint 3.0服务)。集成的Windows安全性一直很好,但这是我第一次尝试通过WCF使用它。

我经历了多次site以确保我有正确的标题。以上错误是否失败,因为它期待“谈判”,但它正在接收“Negotiate,NTLMnProviders”?我知道我可以通过该站点更改我的标题,但它始终具有Kerberos标题的“Negotiate,NTLMnProviders”。有人有任何想法吗?

1 个答案:

答案 0 :(得分:0)

不是真的答案,但这里有更多细节......

<system.serviceModel>
    <bindings>
      <basicHttpBinding>
        <binding name="ListsSoap">
          <security mode="TransportCredentialOnly">
            <transport clientCredentialType="Windows" proxyCredentialType="Windows"/>  
          </security>          
        </binding>
        <binding name="SiteDataSoap">
          <security mode="TransportCredentialOnly">
            <transport clientCredentialType="Windows" proxyCredentialType="Windows"/>
          </security>
        </binding>
      </basicHttpBinding>
    </bindings>
    <client>
      <endpoint address="http://something.com/_vti_bin/lists.asmx"
          binding="basicHttpBinding" bindingConfiguration="ListsSoap"
          contract="WSS_Server.ListsSoap" name="ListsSoap">
        <identity>
          <dns value="localhost" />
        </identity>
      </endpoint>
      <endpoint address="http://something.com/_vti_bin/SiteData.asmx"
          binding="basicHttpBinding" bindingConfiguration="SiteDataSoap"
          contract="WSS_Server_SiteData.SiteDataSoap" name="SiteDataSoap">
        <identity>
          <dns value="localhost" />
        </identity>
      </endpoint>
    </client>
  </system.serviceModel>

然后我实例化我的代理并在代码中调用它...

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

proxy.ClientCredentials.Windows.AllowNtlm = false;

// Web service call
proxy.GetWeb(...);