弄了一天 , 晚饭还没有吃, Silverlight调用wcf安全性的配置

xiaoyan21 2014-06-11 07:16:29
创建的是 "启用了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"这种是比较可靠的,只是我配置不出来
谢谢




...全文
191 2 打赏 收藏 转发到动态 举报
写回复
用AI写文章
2 条回复
切换为时间正序
请发表友善的回复…
发表回复
xiaoyan21 2014-06-12
  • 打赏
  • 举报
回复
加这个当然是想提高wcf的安全性
  • 打赏
  • 举报
回复
加这个东西想干什么?

12,162

社区成员

发帖
与我相关
我的任务
社区描述
.NET技术 Web Services
社区管理员
  • Web Services社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧