Skip to main content

(Solved) The configuration section rewrite/globalRules cannot be read because it is missing a section declaration

IIS stores most of its configuration in the applicationHost.config file. When there are syntax errors or missing entries in this file, one more IIS features may not work and IIS may display an error such as “The configuration section rewrite/globalRules cannot be read“.

In my case, IIS displayed the error message below when we tried to open URL Rewrite module in IIS Manager:

There was an error while performing this operation.

Details:

Filename:
\\?\C:\Windows\system32\inetsrv\config\applicationHost.config
Error: The configuration section ‘system.webServer/rewrite/globalRules’ cannot be read because it is missing a section declaration

The configuration section rewrite/globalRules cannot be read

Solution for “The configuration section rewrite/globalRules cannot be read”

Follow steps below to solve this issue. Please make sure to back up your applicationHost.config file first.

The Most Functional and Compact Toiletry Bag

1. In the IIS server, please check if this file exists: %SystemRoot%\system32\inetsrv\rewrite.dll. If it does, continue the steps below. If it doesn’t, search for the file in the server. If it is not there, it means URL Rewrite is not installed. We will need other set of steps to solve the issue
2. Open applicationHost.config
3. Add this line into the <globalModules> section

<add name="RewriteModule" image="%SystemRoot%\system32\inetsrv\rewrite.dll" />

4. Add the lines below into the <configSections> section:

<sectionGroup name="rewrite">
   <section name="globalRules" overrideModeDefault="Deny" allowDefinition="AppHostOnly" />
   <section name="rules" overrideModeDefault="Allow" />
   <section name="outboundRules" overrideModeDefault="Allow" />
   <section name="providers" overrideModeDefault="Allow" />
   <section name="rewriteMaps" overrideModeDefault="Allow" />
   <section name="allowedServerVariables" overrideModeDefault="Deny" />
</sectionGroup>

5. Add your URL Rewrite rule into the <system.webServer> section:

<rewrite>
  <globalRules>
    <rule name="Remove authToken parameter from Query String" enabled="true" stopProcessing="true">
    <match url=".*" negate="false" />
    <conditions logicalGrouping="MatchAll">
      <add input="{HTTP_REFERER}" pattern="/site" />
      <add input="{QUERY_STRING}" pattern="^((?!keyword=true).)*$" />
    </conditions>
    <action type="Redirect" url="{R:0}?sso=true" appendQueryString="true" redirectType="Temporary" />
    </rule>
  </globalRules>
</rewrite>

6. Save the file
7. Reset IIS
8. Try to open URL Rewrite in IIS Manager again

One of the most common URL Rewrite rules is HTTP to HTTPS redirection rule. Here is a step-by-step guidance about this rule: How to redirect HTTP requests to HTTPS by using IIS URL Rewrite

The Most Functional and Compact Toiletry Bag

Leave a Reply

Your email address will not be published. Required fields are marked *