Self-hosted WCF Data service authentication

时光怂恿深爱的人放手 提交于 2019-12-25 07:26:46

问题


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

How does one add Windows authentication on top of this?

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

Thanks in advance!


回答1:


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>

See this question for detailed answer.



来源:https://stackoverflow.com/questions/15410937/self-hosted-wcf-data-service-authentication

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!