0

I am working on WEB API Windows Authentication. I have added below config in web.config

Getting this issue:

This configuration section cannot be used at this path.

This happens when the section is locked at a parent level. Locking is either by default (overrideModeDefault="Deny"), or set explicitly by a location tag with overrideMode="Deny" or the legacy allowOverride="false"

Please help me on this. Please provide steps how to achieve window authentication in web api

Rajesh Pandya
  • 1,540
  • 4
  • 18
  • 31
shanthi
  • 141
  • 1
  • 1
  • 6

1 Answers1

1

The reason why this error encounters is probably because of the settings to enable windowsauthentication in IIS via the web.config file. To resolve this you have to adjust the applicationhost.config file of the IIS server. You need to tell IIS that his own configuration may be overwritten:

Below steps (simple scenario) to allow windows authentication

  1. Assure the webapi project is using windows authentication.
<system.web>
    <authentication mode="Windows"></authentication>
 </system.web>
  1. Set IIS to windowsAuthenthication and nothing else by configuring the config file
  <system.webServer>
        <security>
              <authentication>
                <windowsAuthentication enabled="true" />
                <anonymousAuthentication enabled="false" />
                <basicAuthentication enabled="false"/>
              </authentication>
            </security> 
 </system.webServer>
  1. Adjust the applicationhost.config of IIS like described above.
free
  • 153
  • 1
  • 2
  • 18