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
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