2014-03-19 51 views
0

我需要調用Web服務並且爲了測試目的,我爲此創建了一個Console-app。但它需要在BizTalk中工作,而事實並非如此。HTTP請求未經客戶端身份驗證方案「協商」授權。從服務器收到的身份驗證頭是'Negotiate'

這是在App.config一個非常簡單的配置:

<basicHttpBinding> 
    <binding name="XXXWebService_Binding" textEncoding="utf-16"> 
     <security mode="TransportCredentialOnly"> 
      <transport clientCredentialType="Windows" /> 
     </security> 
    </binding> 
</basicHttpBinding> 

調用Web服務之前,我需要指定Windows憑據:

proxy.ClientCredentials.Windows.ClientCredential.Domain = "xxx"; 
proxy.ClientCredentials.Windows.ClientCredential.UserName = "xxx"; 
proxy.ClientCredentials.Windows.ClientCredential.Password = "xxx"; 

這工作,因爲它應該工作。

所以我需要得到這個在BizTalk中的工作。我使用帶有basicHttpBinding的WCF定製適配器,具有與我的控制檯應用程序相同的配置: BizTalk basicHttpBinding

要指定憑證,我將它們插入到憑證標籤中。 BizTalk Credentials

當我測試這一點,我得到這個錯誤信息:

System.Net.WebException: The HTTP request is unauthorized with client authentication scheme 'Negotiate'. The authentication header received from the server was 'Negotiate'. 

有誰知道這可能是什麼?

在MSDN上(對於WCF-BasicHttp Adapter),我發現這個: Windows:Windows集成身份驗證。該發送端口運行的用戶帳戶用於服務來驗證此發送端口。

是否可以忽略正確的憑證並使用主機實例的憑證(即使我可以在「傳輸失敗」消息的上下文屬性中找到正確的憑證)?

感謝您的幫助!

回答

3

對於正在執行的進程,Windows身份驗證將使用登錄用戶的帳戶,在BizTalk的情況下,它將是主機實例服務帳戶。

憑證框僅用於基本驗證。這就是它如何連接。

我從來沒有走過這條路,但我認爲您需要使用自定義綁定元素,如行爲來設置備用Windows憑據。

+0

謝謝。我不知道。我寫了一個自定義的EndpointBehavior,它添加了Windows憑據,現在它可以工作了! – Mathieu

相關問題