我有一個客戶用戶名/密碼驗證器。是否足夠使它在web.config中的endpoints bindingConfiguration屬性中,或者是否需要在Service方法中顯式調用它。我注意到,當我不稱它爲服務操作時,它不會被調用。難道我做錯了什麼?只需要在web.config端點BindingConfiguration中具有自定義用戶名驗證程序就足夠了嗎?
這是我有我的綁定部分定義:
<bindings>
<wsHttpBinding>
<binding name="CustomAuthentication">
<security mode="Message">
<message clientCredentialType="UserName"/>
</security>
</binding>
</wsHttpBinding>
</bindings>
這是我有我的服務節點定義:
<service behaviorConfiguration="CustomValidator" name="Test.TestService">
我的端點屬性都有其BindingConfiguration = 「CustomAuthentication」
這就是我在我的ServiceBehavior中定義的行爲:
<behavior name="CustomValidator">
<serviceCredentials>
<userNameAuthentication userNamePasswordValidationMode="Custom"
customUserNamePasswordValidatorType="Test.CustomUserNameValidator, FuzionSync"/>
<serviceCertificate findValue="MyWebSite" storeLocation="LocalMachine" storeName="My" x509FindType="FindBySubjectName"/>
</serviceCredentials>
<serviceMetadata httpGetEnabled="True"/>
</behavior>
當我運行wcf測試客戶端來調用服務調用時,它甚至不調用Validate方法。我需要調用的唯一方法是如果我將它放入一個明確調用的操作中。
如果我是對的,在連接到wcf服務之前,您需要將這些用作證書。 – BreakHead 2011-05-13 14:03:41
@BreakHead,我對你的迴應感到困惑? – Xaisoft 2011-05-13 14:07:55