IIS 7.5: Setting 'app pool user' as the anonymous user programmatically
Asked Answered
A

3

5

I have an web app in IIS 7.5 with its own AppPool using .net 4.

I want to use the feature of having anonymous access as the app pool identity - which is easily configured in a GUI via the inetmgr snapin.

Is there any way do this programmatically, for instance through web.config?

I've looked around and it appears that the anonymousAuthentication element does the trick, but it does not explain how to specify the app pool user in any significant way. I've tried setting my anon user to 'IIS APPPOOL/[AppPoolName]' as seems to be suggested here, with no success.

Any suggestions to how this is supposed to be configured?

Adnate answered 6/9, 2010 at 15:52 Comment(0)
A
5

Taking a closer look at that link: http://www.iis.net/ConfigReference/system.webServer/security/authentication/anonymousAuthentication

'If you leave this value blank (that is, username=""), Anonymous authentication uses the application pool identity to authenticate anonymous users'

Adnate answered 6/9, 2010 at 15:56 Comment(0)
R
3

For the lazy (me)

<system.webServer> <security> <authentication> <anonymousAuthentication userName="" /> </authentication> </security> </system.webServer>

Recently answered 4/11, 2015 at 0:51 Comment(1)
For the ones that are even too lazy to look up the location of the config file: C:\Windows\System32\inetsrv\Config\applicationHost.config.Trioecious
T
0

You can do it programmatically via Ansible like this:

- name: Set 'Anonymous Authentication' to 'Application pool identity'
  community.windows.win_xml:
    path: C:\Windows\System32\inetsrv\Config\applicationHost.config
    xpath: //configuration/system.webServer/security/authentication/anonymousAuthentication
    attribute: userName
    fragment: ''
    type: attribute
Trioecious answered 9/5, 2023 at 12:38 Comment(0)

© 2022 - 2025 — McMap. All rights reserved.