0

我正在開發將成爲許多應用程序與PSI之間的「看門人」的Web服務。問題在於「許多應用程序」會提供登錄名/密碼,而Web服務必須根據PSI對其進行身份驗證。但無論我做什麼,當我打電話給「PSIFormsLogin.Login(用戶,密碼)」方法時,我總是會得到401未授權錯誤...甚至使用運行農場的用戶...PSI身份驗證僅返回401

我也已遵循以下MS教程:http://msdn.microsoft.com/en-us/library/ff181538.aspx

最後我想要做的是驗證使用PSI網絡服務供應的帳戶/密碼,任何人都可以告訴我,我做錯了什麼?

PS:不是WCF

新信息:發生了一些有趣的事情。我有意將URL切換爲不存在的:http://myserver/pwa/_vti_bin/psi/bla.asmx,但我仍然得到了一個401 ...

回答

0

確保您修改了應用程序的web.config,如下所示。只是簡單地覆蓋在結合節點的安全節點:

<binding name="WssInteropSoap"> 
    <security mode="TransportCredentialOnly"> 
    <transport clientCredentialType="Ntlm" proxyCredentialType="Ntlm" 
     realm="" /> 
    <message clientCredentialType="UserName" algorithmSuite="Default" /> 
    </security> 
</binding> 

現在你可以在沒有特殊帳戶(從Windows passtrough)認證或與此代碼,你可以指定一個帳戶:

//credential impersonation (just if you changed your binding settings) 
projectSvc.ClientCredentials.Windows.ClientCredential = new NetworkCredential("username", "password", "domain"); 
projectSvc.ClientCredentials.Windows.AllowedImpersonationLevel = System.Security.Principal.TokenImpersonationLevel.Impersonation; 

我希望這將有助於:)

但是,我從來沒有聽說過一個被稱爲功能:「PSIFormsLogin.Login」

也許我用C#建立與PSI的連接的博客條目很有趣:Read Project Server 2010 CustomFields over PSI

相關問題