我以与此类似的方式设置自托管WCF数据服务 - http://blogs.msdn.com/b/writingdata_services/archive/2011/01/24/self-hosting-a-wcf-data-service.aspx
如何在此基础上添加Windows身份验证?
我知道如何在IIS中添加它,但是自托管的场景正在逃避我......
提前致谢!
答案 0 :(得分:0)
诀窍是使用app.config并在那里配置所有安全设置......:
<?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>
有关详细解答,请参阅this question。