元素的 元素指定是否为 Internet Information Services (IIS) 7 启用使用 Active Directory 的客户端证书映射。
注意
使用 Active Directory 的客户端 证书映射身份验证与使用 IIS 的客户端证书映射身份验证 在以下方面有所不同:
使用 Active Directory 的客户端证书映射身份验证 - 此身份验证方法要求 IIS 7 服务器是 Active Directory 域的成员,并且用户帐户存储在 Active Directory 中。 由于到 Active Directory 服务器的往返,这种客户端证书身份验证方法降低了性能。 IIS 客户端证书映射身份验证 - 此身份验证方法不需要 Active Directory,因此适用于独立服务器。 此客户端证书身份验证方法提高了性能,但需要更多的配置,并且需要访问客户端证书才能创建映射。有关详细信息,请参阅 Microsoft TechNet 网站上的 Configuring Authentication in IIS 7.0(在 IIS 7.0 中配置身份验证 )。
兼容性 版本 备注 IIS 10.0 未 在 IIS 10.0 中修改元素。 IIS 8.5 未 在 IIS 8.5 中修改 元素。 IIS 8.0 未 在 IIS 8.0 中修改 元素。 IIS 7.5 未 在 IIS 7.5 中修改元素。 IIS 7.0 元素 的 元素是在 IIS 7.0 中引入的。 IIS 6.0 空值 设置元素 在 IIS 7 及更高版本的默认安装中不可用。 若要安装它,请使用以下步骤。
Windows Server 2012 或 Windows Server 2012 R2 在任务栏上,单击“服务器管理器”。 在“服务器管理器”中,单击“管理”菜单,然后单击“添加角色和功能”。 在 “添加角色和功能 ”向导中,单击“ 下一步”。 选择安装类型,然后单击“ 下一步”。 选择目标服务器,然后单击“ 下一步”。 在“ 服务器角色” 页上,依次展开“ Web 服务器 (IIS) 、 ”Web 服务器“和” 安全性“,然后选择” 客户端证书映射身份验证”。 单击“下一步”。 . 在“选择功能”页上,单击“下一步”。 在“确认安装选择”页上,单击“安装”。 在“结果”页面中单击“关闭”。 Windows 8 或 Windows 8.1 在“开始”屏幕上,将指针一直移动到左下角,右键单击“开始”按钮,然后单击“控制面板”。 在“控制面板”中,单击“程序和功能”,然后单击“打开或关闭 Windows 功能”。 依次展开 “Internet Information Services”、“ 万维网服务”、“ 安全性”,然后选择“ 客户端证书映射身份验证”。 单击 “确定” 。 单击“关闭”。 Windows Server 2008 或 Windows Server 2008 R2 在任务栏上,单击“开始”,指向“管理工具”,然后单击“服务器管理器”。 在“服务器管理器层次结构”窗格中,展开“角色”,然后单击“Web 服务器 (IIS) ”。 在 “Web 服务器 (IIS) ”窗格中,滚动到 “角色服务” 部分,然后单击“ 添加角色服务”。 在“添加 角色服务向导” 的“选择 角色服务”页上,选择“ 客户端证书映射身份验证”,并单击“ 下一步”。 在“确认安装选择”页中,单击“安装”。 在“结果”页面中单击“关闭”。 Windows Vista 或 Windows 7 在任务栏上,单击“开始”,然后单击“控制面板”。 在“控制面板”中,单击“程序和功能”,然后单击“打开或关闭 Windows 功能”。 展开 “Internet Information Services”,选择“ 客户端证书映射身份验证”,然后单击“ 确定”。 操作方式 如何为服务器启用客户端证书映射身份验证(IIS) 管理器打开 Internet Information Services:
如果使用 Windows Server 2012 或 Windows Server 2012 R2:
在任务栏上,依次单击“服务器管理器”、“工具”和“Internet Information Services (IIS) 管理器”。如果你使用的是 Windows 8 或 Windows 8.1:
按住 Windows 键,按字母 X,然后单击“控制面板”。 单击 “管理工具”,然后双击“ Internet Information Services (IIS) 管理器”。如果使用的是 Windows Server 2008 或 Windows Server 2008 R2:
在任务栏上,单击“ 开始”,指向 “管理工具”,然后单击“ Internet Information Services (IIS) 管理器”。如果你使用的是 Windows Vista 或 Windows 7:
在任务栏上,单击“开始”,然后单击“控制面板”。 双击“ 管理工具”,然后双击“ Internet Information Services (IIS) 管理器”。在“ 连接 ”窗格中,单击服务器名称。
在服务器的“ 主页 ”窗格中,双击“ 身份验证”。
在“身份验证”页上,单击“操作”窗格中的“启用”。
配置 属性 属性 说明 enabled 可选布尔属性。指定是否启用使用 Active Directory 的客户端证书映射身份验证。 若要使此设置生效,必须使用 IIS 管理器设置此属性。 如果使用任何其他方法来设置此属性,则必须重启 Web 服务器才能使设置生效。
默认值为 false。
子元素无。
配置示例以下配置示例使用 Active Directory 为默认网站启用客户端证书映射身份验证,并将站点配置为需要 SSL 和协商客户端证书。
代码示例以下代码示例使用 Active Directory 为默认网站启用客户端证书映射身份验证,并将站点配置为需要 SSL 和协商客户端证书。
AppCmd.exe appcmd.exe set config "Default Web Site" -section:system.webServer/security/authentication/clientCertificateMappingAuthentication /enabled:"True" /commit:apphost appcmd.exe set config "Default Web Site" -section:system.webServer/security/access /sslFlags:"Ssl, SslNegotiateCert" /commit:apphost注意
使用 AppCmd.exe 配置这些设置时,必须确保将 commit 参数设置为 apphost 。 这会将配置设置提交到 ApplicationHost.config 文件中的相应位置部分。
C# using System; using System.Text; using Microsoft.Web.Administration; internal static class Sample { private static void Main() { using (ServerManager serverManager = new ServerManager()) { Configuration config = serverManager.GetApplicationHostConfiguration(); ConfigurationSection clientCertificateMappingAuthenticationSection = config.GetSection("system.webServer/security/authentication/clientCertificateMappingAuthentication", "Default Web Site"); clientCertificateMappingAuthenticationSection["enabled"] = true; ConfigurationSection accessSection = config.GetSection("system.webServer/security/access", "Default Web Site"); accessSection["sslFlags"] = @"Ssl, SslNegotiateCert"; serverManager.CommitChanges(); } } } VB.NET Imports System Imports System.Text Imports Microsoft.Web.Administration Module Sample Sub Main() Dim serverManager As ServerManager = New ServerManager Dim config As Configuration = serverManager.GetApplicationHostConfiguration Dim clientCertificateMappingAuthenticationSection As ConfigurationSection = config.GetSection("system.webServer/security/authentication/clientCertificateMappingAuthentication", "Default Web Site") clientCertificateMappingAuthenticationSection("enabled") = True Dim accessSection As ConfigurationSection = config.GetSection("system.webServer/security/access", "Default Web Site") accessSection("sslFlags") = "Ssl, SslNegotiateCert" serverManager.CommitChanges() End Sub End Module Jascript var adminManager = new ActiveXObject('Microsoft.ApplicationHost.WritableAdminManager'); adminManager.CommitPath = "MACHINE/WEBROOT/APPHOST"; var clientCertificateMappingAuthenticationSection = adminManager.GetAdminSection("system.webServer/security/authentication/clientCertificateMappingAuthentication", "MACHINE/WEBROOT/APPHOST/Default Web Site"); clientCertificateMappingAuthenticationSection.Properties.Item("enabled").Value = true; var accessSection = adminManager.GetAdminSection("system.webServer/security/access", "MACHINE/WEBROOT/APPHOST/Default Web Site"); accessSection.Properties.Item("sslFlags").Value = "Ssl, SslNegotiateCert"; adminManager.CommitChanges(); VBScript Set adminManager = WScript.CreateObject("Microsoft.ApplicationHost.WritableAdminManager") adminManager.CommitPath = "MACHINE/WEBROOT/APPHOST" Set clientCertificateMappingAuthenticationSection = adminManager.GetAdminSection("system.webServer/security/authentication/clientCertificateMappingAuthentication", "MACHINE/WEBROOT/APPHOST/Default Web Site") clientCertificateMappingAuthenticationSection.Properties.Item("enabled").Value = True Set accessSection = adminManager.GetAdminSection("system.webServer/security/access", "MACHINE/WEBROOT/APPHOST/Default Web Site") accessSection.Properties.Item("sslFlags").Value = "Ssl, SslNegotiateCert" adminManager.CommitChanges()