gpt4 book ai didi

c# - 如何将 Windows 身份验证添加到 WCF 应用程序

转载 作者:太空宇宙 更新时间:2023-11-03 11:31:12 25 4
gpt4 key购买 nike

我目前正在使用 C# 开发一个 WCF 项目。我对整个 .NET 领域都很陌生,因为我通常使用 Java,所以请允许我提出一个简单的问题:

如何让我的应用程序请求使用 Windows 密码的凭据(HTTP 摘要/基本)?我尝试了很多谷歌搜索,但很多信息都具有误导性。

这是我的 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 片段。

注意绑定(bind)设置中的安全模式:

      <security mode="TransportCredentialOnly">
<transport clientCredentialType="Windows" />
</security>

关于c# - 如何将 Windows 身份验证添加到 WCF 应用程序,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/7710224/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com