2009-06-02 63 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;