Home
%3CLINGO-SUB%20id%3D%22lingo-sub-873174%22%20slang%3D%22en-US%22%3EError%3A%20Rewrite%2FglobalRules%20cannot%20be%20read%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-873174%22%20slang%3D%22en-US%22%3E%3CDIV%3E%3CFONT%20style%3D%22background-color%3A%20%23ffffff%3B%20box-sizing%3A%20border-box%3B%20color%3A%20%23333333%3B%20font-family%3A%20%26amp%3Bquot%3B%20segoeui%26amp%3Bquot%3B%2C%26amp%3Bquot%3Blato%26amp%3Bquot%3B%2C%26amp%3Bquot%3Bhelvetica%20neue%26amp%3Bquot%3B%2Chelvetica%2Carial%2Csans-serif%3B%20font-size%3A%2016px%3B%20font-style%3A%20normal%3B%20font-variant%3A%20normal%3B%20font-weight%3A%20300%3B%20letter-spacing%3A%20normal%3B%20orphans%3A%202%3B%20text-align%3A%20left%3B%20text-decoration%3A%20none%3B%20text-indent%3A%200px%3B%20text-transform%3A%20none%3B%20-webkit-text-stroke-width%3A%200px%3B%20white-space%3A%20normal%3B%20word-spacing%3A%200px%3B%22%3EIIS%20stores%20majority%20of%20its%20configuration%20in%20the%20applicationHost.config%20file.%20If%20there%20are%20syntax%20errors%20or%20missing%20entries%20in%20this%20file%2C%20one%20or%20more%20IIS%20features%20may%20not%20work.%20In%20this%20case%2C%20IIS%20may%20display%20an%20error%20in%20this%20case.%20In%20my%20case%2C%20IIS%20showed%20the%20error%20message%20below%20once%20we%20tried%20to%20open%20%3CA%20href%3D%22https%3A%2F%2Fdocs.microsoft.com%2Fen-us%2Fiis%2Fextensions%2Furl-rewrite-module%2Fcreating-rewrite-rules-for-the-url-rewrite-module%22%20target%3D%22_blank%22%20rel%3D%22noopener%20noopener%20noreferrer%20noopener%20noreferrer%22%3EURL%20Rewrite%3C%2FA%3E%20module%20in%20IIS%20Manager%3A%3C%2FFONT%3E%3C%2FDIV%3E%0A%3CDIV%3E%26nbsp%3B%3C%2FDIV%3E%0A%3CBLOCKQUOTE%3E%0A%3CDIV%3E%3CFONT%20style%3D%22background-color%3A%20%23ffffff%3B%22%3EThere%20was%20an%20error%20while%20performing%20this%20operation.%3CBR%20%2F%3EFilename%3A%3CBR%20%2F%3E%5C%5C%3F%5CC%3A%5CWindows%5Csystem32%5Cinetsrv%5Cconfig%5CapplicationHost.config%3CBR%20%2F%3EError%3A%20The%20configuration%20section%20%E2%80%98system.webServer%2Frewrite%2FglobalRules%E2%80%99%20cannot%20be%20read%20because%20it%20is%20missing%20a%20section%20declaration%3CBR%20%2F%3E%3C%2FFONT%3E%3C%2FDIV%3E%0A%3C%2FBLOCKQUOTE%3E%0A%3CDIV%3E%26nbsp%3B%3C%2FDIV%3E%0A%3CDIV%3E%3CFONT%20style%3D%22background-color%3A%20%23ffffff%3B%22%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20style%3D%22width%3A%20720px%3B%22%3E%3CIMG%20src%3D%22https%3A%2F%2Fgxcuf89792.i.lithium.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F133352iAE15FCD3E3F96CA7%2Fimage-size%2Flarge%3Fv%3D1.0%26amp%3Bpx%3D999%22%20alt%3D%22URL-rewrite-error.jpg%22%20title%3D%22URL-rewrite-error.jpg%22%20%2F%3E%3C%2FSPAN%3E%3C%2FFONT%3E%3C%2FDIV%3E%0A%3CH3%20id%3D%22toc-hId-1626397785%22%20id%3D%22toc-hId-1626397784%22%3E%3CFONT%20style%3D%22background-color%3A%20%23ffffff%3B%22%3E%3CBR%20%2F%3ESolution%3CBR%20%2F%3E%3C%2FFONT%3E%3C%2FH3%3E%0A%3CDIV%3E%26nbsp%3B%3C%2FDIV%3E%0A%3CDIV%3E%3CFONT%20style%3D%22background-color%3A%20%23ffffff%3B%22%3EFollow%20steps%20below%20for%20solution.%20Please%20back%20up%20your%3CCODE%3EapplicationHost.config%3C%2FCODE%3E%20file%20first.%3CBR%20%2F%3E%3C%2FFONT%3E%3C%2FDIV%3E%0A%3CDIV%3E%26nbsp%3B%3C%2FDIV%3E%0A%3CUL%3E%0A%3CLI%3E%3CFONT%20style%3D%22background-color%3A%20%23ffffff%3B%22%3EIn%20IIS%20server%2C%20check%20if%20this%20file%20exists%3A%20%3CCODE%3E%25SystemRoot%25%5Csystem32%5Cinetsrv%5Crewrite.dll%3C%2FCODE%3E.%20If%20the%20file%20exists%2C%20continue%20the%20steps%20below.%20If%20it%20doesn%E2%80%99t%2C%20search%20for%20the%20file%20in%20server.%20If%20it%20doesn%E2%80%99t%20exist%2C%20it%20means%20URL%20Rewrite%20is%20not%20installed.%20It%20should%20be%20installed%20first%3C%2FFONT%3E%3C%2FLI%3E%0A%3CLI%3E%3CFONT%20style%3D%22background-color%3A%20%23ffffff%3B%22%3EOpen%20%3CCODE%3EapplicationHost.config%3C%2FCODE%3E%20file%3C%2FFONT%3E%3C%2FLI%3E%0A%3CLI%3E%3CFONT%20style%3D%22background-color%3A%20%23ffffff%3B%22%3EAdd%20the%20following%20line%20into%20the%20%3CCODE%3E%3CGLOBALMODULES%3E%3C%2FGLOBALMODULES%3E%3C%2FCODE%3E%20section%3CBR%20%2F%3E%3C%2FFONT%3E%3C%2FLI%3E%0A%3C%2FUL%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CPRE%20class%3D%22lia-code-sample%20language-markup%22%3E%3CCODE%3E%3CADD%20name%3D%22RewriteModule%22%20image%3D%22%25SystemRoot%25%5Csystem32%5Cinetsrv%5Crewrite.dll%22%3E%3C%2FADD%3E%3C%2FCODE%3E%3C%2FPRE%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CUL%3E%0A%3CLI%3E%3CFONT%20style%3D%22background-color%3A%20%23ffffff%3B%22%3EAdd%20the%20lines%20below%20in%20the%20%3CCODE%3E%3CCONFIGSECTIONS%3E%3C%2FCONFIGSECTIONS%3E%3C%2FCODE%3E%20section%3A%3CBR%20%2F%3E%3C%2FFONT%3E%3C%2FLI%3E%0A%3C%2FUL%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CPRE%20class%3D%22lia-code-sample%20language-markup%22%3E%3CCODE%3E%3CSECTIONGROUP%20name%3D%22rewrite%22%3E%0A%20%20%20%3CSECTION%20name%3D%22globalRules%22%20overridemodedefault%3D%22Deny%22%20allowdefinition%3D%22AppHostOnly%22%3E%3C%2FSECTION%3E%0A%20%20%20%3CSECTION%20name%3D%22rules%22%20overridemodedefault%3D%22Allow%22%3E%3C%2FSECTION%3E%0A%20%20%20%3CSECTION%20name%3D%22outboundRules%22%20overridemodedefault%3D%22Allow%22%3E%3C%2FSECTION%3E%0A%20%20%20%3CSECTION%20name%3D%22providers%22%20overridemodedefault%3D%22Allow%22%3E%3C%2FSECTION%3E%0A%20%20%20%3CSECTION%20name%3D%22rewriteMaps%22%20overridemodedefault%3D%22Allow%22%3E%3C%2FSECTION%3E%0A%20%20%20%3CSECTION%20name%3D%22allowedServerVariables%22%20overridemodedefault%3D%22Deny%22%3E%3C%2FSECTION%3E%0A%3C%2FSECTIONGROUP%3E%3C%2FCODE%3E%3C%2FPRE%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CUL%3E%0A%3CLI%3E%3CFONT%20style%3D%22background-color%3A%20%23ffffff%3B%22%3EAdd%20your%20URL%20Rewrite%20rule%20in%20the%20%3CCODE%3E%3CSYSTEM.WEBSERVER%3E%3C%2FSYSTEM.WEBSERVER%3E%3C%2FCODE%3E%20section.%20Example%3A%3CBR%20%2F%3E%3C%2FFONT%3E%3C%2FLI%3E%0A%3C%2FUL%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CPRE%20class%3D%22lia-code-sample%20language-markup%22%3E%3CCODE%3E%3CREWRITE%3E%0A%20%20%3CGLOBALRULES%3E%0A%20%20%20%20%3CRULE%20name%3D%22Remove%20authToken%20parameter%20from%20Query%20String%22%20enabled%3D%22true%22%20stopprocessing%3D%22true%22%3E%0A%20%20%20%20%20%20%20%20%20%E2%80%A6%0A%20%20%20%20%3C%2FRULE%3E%0A%20%20%3C%2FGLOBALRULES%3E%0A%3C%2FREWRITE%3E%3C%2FCODE%3E%3C%2FPRE%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CUL%3E%0A%3CLI%3E%3CFONT%20style%3D%22background-color%3A%20%23ffffff%3B%22%3ESave%20the%20file%3C%2FFONT%3E%3C%2FLI%3E%0A%3CLI%3E%3CFONT%20style%3D%22background-color%3A%20%23ffffff%3B%22%3EReset%20IIS%3CBR%20%2F%3E%3C%2FFONT%3E%3C%2FLI%3E%0A%3C%2FUL%3E%3C%2FLINGO-BODY%3E%3CLINGO-TEASER%20id%3D%22lingo-teaser-873174%22%20slang%3D%22en-US%22%3E%3CP%3E%3CFONT%20style%3D%22background-color%3A%20%23ffffff%3B%20box-sizing%3A%20border-box%3B%20color%3A%20%23333333%3B%20font-family%3A%20%26amp%3Bquot%3B%20segoeui%26amp%3Bquot%3B%2C%26amp%3Bquot%3Blato%26amp%3Bquot%3B%2C%26amp%3Bquot%3Bhelvetica%20neue%26amp%3Bquot%3B%2Chelvetica%2Carial%2Csans-serif%3B%20font-size%3A%2016px%3B%20font-style%3A%20normal%3B%20font-variant%3A%20normal%3B%20font-weight%3A%20300%3B%20letter-spacing%3A%20normal%3B%20orphans%3A%202%3B%20text-align%3A%20left%3B%20text-decoration%3A%20none%3B%20text-indent%3A%200px%3B%20text-transform%3A%20none%3B%20-webkit-text-stroke-width%3A%200px%3B%20white-space%3A%20normal%3B%20word-spacing%3A%200px%3B%22%3EIIS%20stores%20majority%20of%20its%20configuration%20in%20the%20applicationHost.config%20file.%20If%20there%20are%20syntax%20errors%20or%20missing%20entries%20in%20this%20file%2C%20one%20or%20more%20IIS%20features%20may%20not%20work.%20In%20this%20case%2C%20IIS%20may%20display%20an%20error%20in%20this%20case.%3C%2FFONT%3E%3C%2FP%3E%3C%2FLINGO-TEASER%3E
Microsoft
IIS stores majority of its configuration in the applicationHost.config file. If there are syntax errors or missing entries in this file, one or more IIS features may not work. In this case, IIS may display an error in this case. In my case, IIS showed the error message below once we tried to open URL Rewrite module in IIS Manager:
 
There was an error while performing this operation.
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
 
URL-rewrite-error.jpg


Solution

 
Follow steps below for solution. Please back up your applicationHost.config file first.
 
  • In IIS server, check if this file exists: %SystemRoot%\system32\inetsrv\rewrite.dll. If the file exists, continue the steps below. If it doesn’t, search for the file in server. If it doesn’t exist, it means URL Rewrite is not installed. It should be installed first
  • Open applicationHost.config file
  • Add the following line into the <globalModules> section

 

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

 

  • Add the lines below in 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>

 

  • Add your URL Rewrite rule in the <system.webServer> section. Example:

 

<rewrite>
  <globalRules>
    <rule name="Remove authToken parameter from Query String" enabled="true" stopProcessing="true">
         …
    </rule>
  </globalRules>
</rewrite>

 

  • Save the file
  • Reset IIS