MessageSecurityOverHttp.NegotiateServiceCredential 屬性
定義
重要
部分資訊涉及發行前產品,在發行之前可能會有大幅修改。 Microsoft 對此處提供的資訊,不做任何明確或隱含的瑕疵擔保。
會取得或設定一個值,指示服務憑證是在用戶端的帶外配置,還是透過協商過程從服務取得。
public:
property bool NegotiateServiceCredential { bool get(); void set(bool value); };
public bool NegotiateServiceCredential { get; set; }
member this.NegotiateServiceCredential : bool with get, set
Public Property NegotiateServiceCredential As Boolean
屬性值
true若服務憑證是透過協商程序取得;否則,。 false 預設值為 true。
範例
以下程式碼說明如何存取並設定此屬性。
WSHttpBinding binding = new WSHttpBinding();
binding.Security.Mode = SecurityMode.Message;
binding.Security.Message.ClientCredentialType =
MessageCredentialType.UserName;
binding.Security.Message.NegotiateServiceCredential = false;
CalculatorClient CalculatorClient = new CalculatorClient("myBinding");
CalculatorClient.ClientCredentials.ServiceCertificate.
SetDefaultCertificate("Al", StoreLocation.CurrentUser, StoreName.My);
Dim binding As New WSHttpBinding()
binding.Security.Mode = SecurityMode.Message
binding.Security.Message.ClientCredentialType = _
MessageCredentialType.UserName
binding.Security.Message.NegotiateServiceCredential = False
Dim CalculatorClient As New CalculatorClient("myBinding")
CalculatorClient.ClientCredentials.ServiceCertificate. _
SetDefaultCertificate("Al", StoreLocation.CurrentUser, StoreName.My)
備註
將此屬性設為 true,需要客戶端與服務支持 WS-Trust 和 WS-SecureConversation。 將此屬性設為 並不 false 要求支援 WS-Trust 或 WS-SecureConversation。
對於匿名、使用者名稱或憑證用戶端憑證類型,將此屬性 false 設為意味著服務憑證必須在用戶端的頻帶外提供,且用戶端必須指定服務憑證以使用。
對於Windows憑證,將此屬性設為 false 會產生基於 KerberosToken 的認證。 這需要客戶端和服務必須屬於 Kerberos 網域。 此模式可與實作 OASIS Kerberos 令牌設定檔的 SOAP 堆疊互通。 將此屬性設為 會 true 引發 SOAP 協商,透過 SOAP 訊息隧道 SPNego 交換。 此模式無法互通。
此特性表示服務憑證是否會在用戶端與服務之間自動協商。 若此性質為 true,則會發生此類協商。 若此屬性為 false,則必須在用戶端指定服務憑證,才能與服務進行通訊。
若此屬性設定為 false,且綁定設定為使用 Windows 作為用戶端憑證類型,則服務帳號必須與服務主體名稱(SPN)相關聯。 要做到這點,請以 NETWORK SERVICE 帳號或 LOCAL SYSTEM 帳號執行該服務。 或者,使用 SetSpn.exe 工具來建立服務帳戶的 SPN。 不論是何種情況,用戶端都必須在 <servicePrincipalName> 元素中使用正確的 SPN,或是使用 EndpointAddress 建構函式。 如需詳細資訊,請參閱服務識別和驗證。