0

我正在实现消息安全。下面是我的 Web 配置文件。我确实有一个实现 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" />

问候,

萨钦K

4

0 回答 0