【问题标题】:Using Asp.Net Membership in WCF在 WCF 中使用 Asp.Net 成员资格
【发布时间】:2011-06-27 11:37:24
【问题描述】:

我有一个使用 ASP.net Membership Provider 的网站。该网站将由一组 WCF 服务提供服务。我需要从当前在服务层调用服务的用户中提取配置文件变量。我正在使用 wsHttpBinding,并且正在关注 MSDN 文章。

how to use the ASP.NET Membership provider in WCF

谁能帮我设置这个例子的客户端?

【问题讨论】:

    标签: 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";
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2023-04-05
      • 2011-03-19
      • 2010-12-14
      • 1970-01-01
      • 2011-02-03
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多