如何将Windows身份验证添加到WCF应用程序
问题描述:
我目前正在C#中使用WCF项目。我对整个.NET领域都很陌生,因为我通常在做Java,所以请允许我提出一个简单的问题:如何将Windows身份验证添加到WCF应用程序
如何让我的应用程序请求使用Windows密码的凭证(HTTP Digest/Basic)?我尝试了很多谷歌搜索,但很多信息都是误导性的。
这他我的web.config目前的样子:
<?xml version="1.0"?>
<configuration>
<system.web>
<compilation debug="true" targetFramework="4.0" />
</system.web>
<system.webServer>
<modules runAllManagedModulesForAllRequests="true">
<add name="UrlRoutingModule" type="System.Web.Routing.UrlRoutingModule, System.Web, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
</modules>
</system.webServer>
<system.serviceModel>
<serviceHostingEnvironment aspNetCompatibilityEnabled="true"/>
<standardEndpoints>
<webHttpEndpoint>
<standardEndpoint name="" helpEnabled="true" automaticFormatSelectionEnabled="true">
</standardEndpoint>
</webHttpEndpoint>
</standardEndpoints>
</system.serviceModel>
</configuration>
答
试试这个:http://msdn.microsoft.com/en-us/library/ff648505.aspx
向下滚动到XML片段。
注意安全模式在绑定设置:
<security mode="TransportCredentialOnly">
<transport clientCredentialType="Windows" />
</security>