我正在实现Message Security .Below是我的web配置文件。我有一个Validator 实现UserNamePasswordValidator的MyValidator。我得到了上述错误。
<system.serviceModel>
<bindings>
<wsHttpBinding>
<binding name="Binding1">
<security mode="Message">
<message clientCredentialType="UserName"/>
</security>
</binding>
</wsHttpBinding>
</bindings>
<services>
<service name="MessageSecurity.ServiceCalculateCost" behaviorConfiguration="ServiceBehaviour">
<endpoint address="http://localhost:50456/Service1.svc" binding="wsHttpBinding" bindingConfiguration="Binding1" contract="MessageSecurity.IServiceCalculateCost"></endpoint>
<endpoint contract="IMetadataExchange" binding="mexHttpBinding" address="mex" />
</service>
</services>
<behaviors>
<serviceBehaviors>
<behavior name="ServiceBehaviour">
<!-- To avoid disclosing metadata information, set the value below to false and remove the metadata endpoint above before deployment -->
<serviceMetadata httpGetEnabled="true"/>
<serviceCredentials>
<userNameAuthentication userNamePasswordValidationMode="Custom" customUserNamePasswordValidatorType="MyValidator,MessageSecurity"></userNameAuthentication>
</serviceCredentials>
<!-- To receive exception details in faults for debugging purposes, set the value below to true. Set to false before deployment to avoid disclosing exception information -->
<serviceDebug includeExceptionDetailInFaults="false"/>
</behavior>
</serviceBehaviors>
</behaviors>
<serviceHostingEnvironment multipleSiteBindingsEnabled="true" />
此致
Sachin K