问题
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