【发布时间】:2011-03-30 11:55:03
【问题描述】:
我在正确配置 WCF 以确保安全时遇到问题。下面的配置根本无法识别我正在尝试使用 CustomUserNamePasswordValidator。当我测试服务时,Validator 类会被忽略,就好像我从未配置过任何东西一样。任何人都可以在此配置中发现问题吗?任何帮助将不胜感激。
<?xml version="1.0"?>
<service behaviorConfiguration="defaultServiceBehavior" name="SSAServices.SelfServiceAdvertiserService">
<endpoint address="/2.4/SelfServiceAdvertiserService.svc" binding="wsHttpBinding" contract="SSAServiceContracts.Two_Four.ISelfServiceAdvertiserService" bindingConfiguration="serviceBinding" />
</service>
</services>
<bindings>
<wsHttpBinding>
<binding name="serviceBinding" >
<security mode="Message">
<message clientCredentialType="UserName" />
</security>
</binding>
</wsHttpBinding>
</bindings>
<behaviors>
<serviceBehaviors>
<behavior name="">
<serviceMetadata httpGetEnabled="true"/>
<serviceDebug includeExceptionDetailInFaults="false"/>
</behavior>
<behavior name="defaultServiceBehavior">
<serviceMetadata httpGetEnabled="true"/>
<serviceDebug includeExceptionDetailInFaults="false"/>
<serviceCredentials>
<userNameAuthentication userNamePasswordValidationMode="Custom" customUserNamePasswordValidatorType="ServiceAuthenticationBase, SSAServices" />
</serviceCredentials>
</behavior>
</serviceBehaviors>
</behaviors>
<serviceHostingEnvironment multipleSiteBindingsEnabled="true"/>
</system.serviceModel>
<system.webServer>
<modules runAllManagedModulesForAllRequests="true">
</modules>
</system.webServer>
【问题讨论】:
-
您有任何错误吗?该服务是否适用于此配置?
-
该服务确实有效。它只是忽略了配置。
-
这可能与我使用 VS 开发服务器有关吗?
标签: .net wcf wcf-security