Windows身份验证失败,需要重置

时间:2020-07-10 13:21:10

标签: powershell iis windows-authentication

我有一个启用了Windows身份验证的现有IIS Web应用程序。当我运行此命令时,要设置绑定,Windows身份验证将失败,我必须手动禁用并重新启用Windows身份验证才能使其正常工作。

import-module WebAdministration
Set-ItemProperty "IIS:\Sites\Test\My" -name bindings -value (@{protocol="https";bindingInformation="*:443:my.test.com";sslFlags=1},@{protocol="net.tcp";bindingInformation="808:my.test.com"})

我尝试使用Powershell设置Windows身份验证,但没有效果。

Set-WebConfigurationProperty -filter /system.WebServer/security/authentication/WindowsAuthentication -name enabled -value true -PSPath "IIS:\Sites\TestMy"

有什么建议吗?

1 个答案:

答案 0 :(得分:0)

问题的原因可能是我们尚未将证书绑定到特定端口。
指定Https绑定后,请将证书绑定到该端口。

Netsh http add sslcert ipport = 1.1.1.1:443 certhash = 0102030405060708090A0B0C0D0E0F1011121314 appid = {00112233-4455-6677-8899-AABBCCDDEEFF}

https://docs.microsoft.com/en-us/windows/win32/http/add-sslcert
这通常由IIS完成。没有此过程,该网站可能无法通过https绑定正常工作。您可以尝试在网站上设置HTTP绑定,以便排除这一点。
如果问题仍然存在,请随时告诉我。