【问题标题】:Using Asp.Net Membership in WCF在 WCF 中使用 Asp.Net 成员资格
【发布时间】:2011-06-27 11:37:24
【问题描述】:
【问题讨论】:
标签:
asp.net
wcf
wcf-security
【解决方案1】:
您的客户端配置应与服务器配置匹配:
<configuration>
<system.serviceModel>
...
<bindings>
<wsHttpBinding>
<binding name="MembershipBinding">
<security mode="Message">
<message clientCredentialType="UserName" />
</security>
</binding>
</wsHttpBinding>
</bindings>
</system.serviceModel>
</configuration>
当您连接到您的服务时,您需要在客户端代理上设置用户名和密码:
client.ClientCredentials.UserName.UserName = "userName";
client.ClientCredentials.UserName.Password = "password";