使用Powershell配置IIS - 启用表单身份验证 [英] Configuring IIS with Powershell - Enable Forms Authentication
问题描述
我的IIS看起来像这样:
My IIS looks like this:
Sites ->
Default Web Site ->
MyWebApp
然后问题是:如何在MyWebApp上启用表单身份验证?我可以更改或编辑匿名访问,基本和Windows身份验证。但是,Forms Auth并不那么容易。我如何在Powershell中执行此操作?
Then the question is: How do I enable Forms Authentication on MyWebApp? I mange to change or edit Anonymous Access, Basic, and Windows Auth. However, Forms Auth is not that easy. How do I do this in Powershell?
我可以通过这种方式阅读设置:
I'm able to read the setting this way:
(Get-WebConfiguration system.web / authentication'IIS: \sites\Default Web Site \ MyWebApp')。模式
我在使用Set-Webconfiguration或Set-Webconfiguration属性时遇到了麻烦或运气不好。我发现这些cmdlet很难理解。
I'm having trouble or no luck with Set-Webconfiguration, or Set-Webconfigurationproperty. I find these cmdlets hard to figure out.
在web.config中发生更改,至少在我在IIS上的表单身份验证上启用或禁用时,web.config更新经理。任何线索和提示都非常受欢迎。
Change happens in web.config, at least the web.config updates when I hit Enable or Disable on Forms Authentication at the IIS manager. Any clues and tips are highly appreciated.
推荐答案
您将身份验证配置设置传输到Set-Webconfiguration,在您修改后提供适当的过滤器你的属性:
You pipe the authentication configuration settings to Set-Webconfiguration giving the appropriate filter after you modify your properties:
$config = (Get-WebConfiguration system.web/authentication 'IIS:\sites\Default Web Site')
$config.mode = "Forms"
$config | Set-WebConfiguration system.web/authentication
注意:在尝试之前备份您的配置。
这篇关于使用Powershell配置IIS - 启用表单身份验证的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!