Ntlm身份验证失败

时间:2014-09-02 09:20:25

标签: c# .net sharepoint soap

我有这个客户端模块(C#.net 3.5)需要从sharepoint获取日历。 在服务器开始使用https之前,一切正常。

我现在得到的错误是:

   System.ServiceModel.Security.MessageSecurityException: The HTTP request is unauthorized with client authentication scheme 'Ntlm'. The authentication header received from the server was 'NTLM'. ---> System.Net.WebException: The remote server returned an error: (401) Unauthorized. 

我是否正确理解我使用Ntlm身份验证拒绝访问,因为服务器要我使用Ntlm身份验证?

[编辑]一些代码

    ListsSoapClient service = new ServiceReference.ListsSoapClient();
    service.ClientCredentials.Windows.ClientCredential = new NetworkCredential("username", "passwd", "domain");

在我的Web.config

   <binding name="ListsSoap" closeTimeout="00:01:00" Timeout="00:01:00" receiveTimeout="00:10:00" sendTimeout="00:01:00" allowCookies="false" bypassProxyOnLocal="false" hostNameComparisonMode="StrongWildcard" maxBufferSize="2147483647" maxBufferPoolSize="524288" maxReceivedMessageSize="2147483647" messageEncoding="Text" textEncoding="utf-8" transferMode="Buffered" useDefaultWebProxy="true">
      <readerQuotas maxDepth="32" maxStringContentLength="8192" maxArrayLength="16384" maxBytesPerRead="4096" maxNameTableCharCount="16384"/>
      <security mode="TransportCredentialOnly">
        <transport clientCredentialType="Ntlm" proxyCredentialType="None" realm=""/>
        <message clientCredentialType="UserName" algorithmSuite="Default"/>
      </security>
    </binding>
    ......
    <client>
  <clear/>
      <endpoint address="http://www.yyyy.zz/Lists.asmx" binding="basicHttpBinding" bindingConfiguration="ListsSoap" contract="ServiceReference.ListsSoap" name="ListsSoap"/>
</client>

0 个答案:

没有答案