开发者

Set Specific IIS 7 Site with AppCmd?

开发者 https://www.devze.com 2023-01-08 17:03 出处:网络
I have an IIS 7 machine with multiple apps/vdirs on the single default web site. I would like to set two of them with this authentication:

I have an IIS 7 machine with multiple apps/vdirs on the single default web site. I would like to set two of them with this authentication: anonymous - off impersonation - on forms auth - off windows auth - on

I would开发者_如何学Python like to do this with appcmd.exe but cannot seem to get the syntax down right. Has anyone had luck with this?

Thanks.


You should try Configuration Editor (included in IIS 7.5 and available for download for IIS 7.0 at http://www.iis.net/download/AdministrationPack), it can generate the AppCmd.exe commands automatically as well as javascript and managed code. Using it I generated the following (for default web site):

appcmd.exe set config "Default Web Site" -section:system.webServer/security/authentication/anonymousAuthentication /enabled:"False"  

appcmd.exe set config "Default Web Site" -section:system.web/identity /impersonate:"True"  

appcmd.exe set config "Default Web Site" -section:system.webServer/security/authentication/windowsAuthentication /enabled:"True"  /commit:apphost

Note that the ones with commit:apphost are because the sections are locked by default which means they need to be set inside ApplicationHost.config using location paths.


unlock first:

appcmd unlock config /section:windowsAuthentication

refer to: How to set authentication with appcmd.exe or ServerManager

0

精彩评论

暂无评论...
验证码 换一张
取 消