【问题标题】:pass user credentials from aspnet site to wcf service将用户凭据从 aspnet 站点传递到 wcf 服务
【发布时间】:2011-01-26 09:49:52
【问题描述】:

如何将用户凭据从 aspnet 站点传递到 wcf 服务?

  • 没有冒充。 (网站必须由特定用户执行)
  • 不知道来电者密码。
  • 只传递某种神秘的安全上下文。

网站和 WCF 服务都使用 windows/NTLM 登录:authentication mode="Windows"

WCF 服务使用:binding="wsHttpBinding"

IIS 7.5。 2 台服务器 (2008r2)。

背后的网站代码(当前 - 为执行网站的用户传递凭据):

protected void btSend_Click(object sender, EventArgs e)
{
  FunctionWhichCanOnlyBeCalledByASpecificUser();
  MyService.MyServiceClient s = new MyService.MyServiceClient();
  s.SendMyMessage(tbMessage.Text);
}

【问题讨论】:

    标签: wcf credentials


    【解决方案1】:

    在许多情况下,您可以使用 ASP.NET 兼容模式,只需将此行添加到您的配置中:

     <system.serviceModel>        
          <serviceHostingEnvironment aspNetCompatibilityEnabled="true" />    
     </system.serviceModel>
    

    Reference

    【讨论】:

      猜你喜欢
      • 2012-08-19
      • 1970-01-01
      • 2015-11-15
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2013-10-06
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多