使用SharePoint列表Web服务的身份验证错误

时间:2010-11-04 23:30:43

标签: sharepoint-2007

我一直在研究很多关于这个问题,但仍然没有找到适合我的解决方案。我正在尝试使用SP List Web服务从SharePoint网站集中检索文档库列表,因此我在我的控制台应用程序中添加了一个服务引用,我的绑定如下所示:(使用Kerberos的Sharepoint 2007失败了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”。从服务器收到的身份验证标头是“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)

任何线索??

提前致谢

0 个答案:

没有答案