2009-06-02 61 views
12

我要疯了这一个,并不能在任何地方找到任何像样的信息到SharePoint ..连接和认证与WCF

有大量的信息有关连接到SharePoint 3.0 Web服务与WCF和NTLM各地模拟。但是,访问SharePoint服务的客户端远离SharePoint网络并需要进行身份验证时,如何最好地配置SharePoint Services并将凭据传递给SharePoint服务。

我可以为servicemodel.config中的SharePoint框指定一个本地Windows用户名和密码。我们的SharePoint实例在访问它的域之外以独立方式运行。因此,模拟是无关紧要的,因为域用户不在Sharepoint框中。

我已经尝试了多种组合,如下面的代码。但是我一再得到例外,如:

“HTTP请求是未经授权的客户端身份验证方案‘匿名’从服务器接收的身份验证标头是“ NTLM,基本境界= “wss.internaldev.local””

任何人都可以提供连接到 “远程” 的SharePoint Web服务与Windows凭据的例子

ListsSoapClient proxy = new ListsSoapClient(); 

proxy.ClientCredentials.Windows.ClientCredential.UserName = "admin_user"; 
proxy.ClientCredentials.Windows.ClientCredential.Password = "admin_password"; 
proxy.ClientCredentials.Windows.AllowedImpersonationLevel = System.Security.Principal.TokenImpersonationLevel.Identification; 

listItems = proxy.GetListItems(...); 

proxy.Close(); 

绑定的例子:?

<security mode="TransportCredentialOnly"> 
    <transport clientCredentialType="Windows" proxyCredentialType="None" /> 
</security> 

或..

<security mode="TransportCredentialOnly"> 
    <transport clientCredentialType="Ntlm" /> 
</security> 

行为:

<behavior name="behavior_WSS"> 
    <clientCredentials> 
    <windows allowedImpersonationLevel="Impersonation" allowNtlm="true" /> 
    </clientCredentials> 
</behavior> 

<windows allowedImpersonationLevel="Delegation" allowNtlm="true" /> 
+1

这个问题可能更适合ServerFault,COM – Jazza 2010-05-13 10:09:38

+1

有CodePlex上是增加WCF支持到SharePoint项目。 http://spwcfsupport.codeplex.com/ – Hameds 2010-06-04 17:14:59

回答

1

你尝试the things suggested here

例如,在代码:

proxy.ClientCredentials.Windows.AllowedImpersonationLevel = TokenImpersonation.Impersonate; 
// AllowNtlm = false;