自承载 WCF 数据服务身份验证 [英] Self-hosted WCF Data service authentication

查看:31
本文介绍了自承载 WCF 数据服务身份验证的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我以与此类似的方式设置了自托管 WCF 数据服务 - http://blogs.msdn.com/b/writingdata_services/archive/2011/01/24/self-hosting-a-wcf-data-service.aspx

I have self-hosted WCF Data service set up in similar way to this - http://blogs.msdn.com/b/writingdata_services/archive/2011/01/24/self-hosting-a-wcf-data-service.aspx

如何在此基础上添加 Windows 身份验证?

How does one add Windows authentication on top of this?

我知道如何在 IIS 中添加它,但是自托管的场景却让我望而却步...

I know how to add it in IIS however self-hosted scenario is escaping me...

提前致谢!

推荐答案

诀窍是使用 app.config 并在那里配置所有安全设置...:

The trick is to use app.config and configure all the security settings there...:

<?xml version="1.0" encoding="utf-8"?>
<configuration>
  <system.serviceModel>
    <bindings>
      <webHttpBinding>
        <binding name="MyBindingName" >
          <security mode="Transport">
            <transport clientCredentialType="Windows" />
          </security>
        </binding>
      </webHttpBinding>
    </bindings>
    <services>
      <service name="{you service type name including the namespace i.e. myapplication.myservice}">
        <endpoint address="" binding="webHttpBinding" bindingConfiguration="MyBindingName" contract="System.Data.Services.IRequestHandler">
        </endpoint>
      </service>
    </services>
  </system.serviceModel>
</configuration>

查看这个问题的详细答案.

这篇关于自承载 WCF 数据服务身份验证的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆