Ошибка аутентификации с использованием веб-службы списка SharePoint - PullRequest
3 голосов
/ 05 ноября 2010

Я много исследовал эту проблему, но так и не нашел решения, которое бы мне помогло.Я пытаюсь получить список библиотек документов из семейства сайтов SharePoint с помощью веб-службы SP List, поэтому я добавил ссылку на службу в свое консольное приложение, и моя привязка выглядит следующим образом: (Sharepoint 2007, использующий Kerberos, возвращается при сбоеNTLM)

<bindings>
 <basicHttpBinding>
  <binding name="ListsSoap" 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="Text" textEncoding="utf-8" transferMode="Buffered"
     useDefaultWebProxy="true">
     <readerQuotas maxDepth="32" maxStringContentLength="8192" maxArrayLength="16384"
                    maxBytesPerRead="4096" maxNameTableCharCount="16384" />
     <security mode="TransportCredentialOnly">
            <transport clientCredentialType="Windows" proxyCredentialType="None"
                realm="" />
            <message clientCredentialType="UserName" algorithmSuite="Default" />
     </security>
  </binding>
 </basicHttpBinding>
</bindings>

Мой клиент:

<client>
        <endpoint address="http://SPUrl/_vti_bin/Lists.asmx"
            binding="basicHttpBinding" bindingConfiguration="ListsSoap"
            contract="SPSListWebReference.ListsSoap" name="ListsSoap" />            
</client>

И мой код:

SPSListWebReference.ListsSoapClient listService = new  SPSListWebReference.ListsSoapClient();
string user = ConfigurationManager.AppSettings["user"];
string password = ConfigurationManager.AppSettings["password"];
string domain = ConfigurationManager.AppSettings["domain"];

listService.ClientCredentials.Windows.AllowedImpersonationLevel =
                System.Security.Principal.TokenImpersonationLevel.Delegation;
listService.ClientCredentials.Windows.ClientCredential =
                new System.Net.NetworkCredential(user, password, domain);
listService.GetListCollection();

Это исключение, которое я получаю:

HTTP-запрос не авторизован по схеме аутентификации клиента «Согласование».Заголовок аутентификации, полученный от сервера, был 'Negotiate, NTLM'.

System.Net.WebException: The remote server returned an error: (401) Unauthorized.
   at System.Net.HttpWebRequest.GetResponse()
   at System.ServiceModel.Channels.HttpChannelFactory.HttpRequestChannel.HttpChannelRequest.WaitForReply(TimeSpan timeout)
Server stack trace: 
   at System.ServiceModel.Channels.HttpChannelUtilities.ValidateAuthentication(HttpWebRequest request, HttpWebResponse response, WebException responseException, HttpChannelFactory factory)
   at System.ServiceModel.Channels.HttpChannelUtilities.ValidateRequestReplyResponse(HttpWebRequest request, HttpWebResponse response, HttpChannelFactory factory, WebException responseException)
   at System.ServiceModel.Channels.HttpChannelFactory.HttpRequestChannel.HttpChannelRequest.WaitForReply(TimeSpan timeout)
   at System.ServiceModel.Channels.RequestChannel.Request(Message message, TimeSpan timeout)
   at System.ServiceModel.Dispatcher.RequestChannelBinder.Request(Message message, TimeSpan timeout)
   at System.ServiceModel.Channels.ServiceChannel.Call(String action, Boolean oneway, ProxyOperationRuntime operation, Object[] ins, Object[] outs, TimeSpan timeout)
   at System.ServiceModel.Channels.ServiceChannel.Call(String action, Boolean oneway, ProxyOperationRuntime operation, Object[] ins, Object[] outs)
   at System.ServiceModel.Channels.ServiceChannelProxy.InvokeService(IMethodCallMessage methodCall, ProxyOperationRuntime operation)
   at System.ServiceModel.Channels.ServiceChannelProxy.Invoke(IMessage message)

Любая подсказка ??

Заранее спасибо

Добро пожаловать на сайт PullRequest, где вы можете задавать вопросы и получать ответы от других членов сообщества.
...