弄了一天 , 晚饭还没有吃, Silverlight调用wcf安全性的配置
创建的是 "启用了silverlight的WCF" Service1.svc
在web.config中做了这个配置
<bindings>
<customBinding>
<binding name="defaultBinding">
<binaryMessageEncoding />
<security authenticationMode="UserNameOverTransport"></security> //就添加了这一句
<httpTransport />
</binding>
</customBinding>
</bindings>
运行时出现了如下错误:
“Service1”.“”协定的“CustomBinding”.“http://tempuri.org/”绑定是使用要求传输水平完整性和保密性的身份验证模式进行配置的。但是,传输不能提供完整性和保密性。 "
查询了相关资料,
UserNameOverTransport
在此身份验证模式中,客户端使用用户名令牌进行身份验证,此证书作为经过签名的支持令牌(即签署消息签名的令牌)显示在 SOAP 层上。 在传输层,服务是用 X.509 证书进行身份验证的。
那我想应该是要添加证书的, 创建了证书myWCFCert ,并配置在web.config中
<behaviors>
<serviceBehaviors>
<behavior name="">
<serviceMetadata httpGetEnabled="false" httpsGetEnabled="true" />
<serviceCredentials>
<serviceCertificate findValue="myWCFCert" storeName="My" storeLocation="LocalMachine" x509FindType="FindBySubjectName"/> // 指定证书, 指定用户名和密码的验证配置
<userNameAuthentication userNamePasswordValidationMode="Custom"
customUserNamePasswordValidatorType="temp0611.Web.CustomUserNameValidator,temp0611.Web"/>
</serviceCredentials>
<serviceDebug includeExceptionDetailInFaults="false" />
</behavior>
</serviceBehaviors>
</behaviors>
经测试,还是以上这个错误 .
求各位大侠帮忙, 帮忙看看这个问题,或 给一个新的配置方案(其它验证模式的), 感觉 "UserNameOverTransport"这种是比较可靠的,只是我配置不出来
谢谢