Problem
When running a web application, we got:
Reason
IIS allows server administrators to prevent users from overriding specific configuration directives in a user-defined web.config file. This is similar to the AllowOverride directive in Apache. The error states that a configuration directive used in our suggested web.config file cannot be overridden.
Resolution
- Open %SystemRoot%\System32\inetsrv\config\applicationHost.config
- Search for the statements below and change the allowOverride attribute from Deny to Allow
-
<section name="handlers" allowOverride="Deny" />
<section name="modules" allowOverride="Deny" />
Restart IIS
Besides this, we may have eazy fixes whthout knowing the reason.
Fix 1
A lazy fix by myself, just installing the whole components for IIS, by
- Control Panel
- Programs
- Programs and Features
- Turn Windows Feature on or off
Or,
- Click the "Start button"
- lIn the search box, enter "Turn windows features on or off".
such as:
it works.
Fix 2
Somebody suggested we do not need to install the whole components of IIS; just need to install the "Application Development Features" except CGI. It works too.
or:
Fix 3
Somebody suggested:
I was missing the .NET 4.x integration in IIS. then I just choose:
- Application Development Features => ASP.NET 4.X
I have never tried this solution, but you may try it.
References