I tried using
<rewrite> in web.config and received HTTP Error 500.19 error code 0x8007000d.
Went to IIS Manager, found the "URL Rewrite" icon (which means that the module is already installed and I don't have to install it again), but clicking on it gave a generic "There was an error while performing this operation" error.
It didn't matter which website (or the server itself) I selected, clicking on the corresponding "URL Rewrite" icon still gave the same error message.
At some point the error message started showing an additional detail: "The configuration section 'system.webServer/rewrite/globalRules' cannot be read because it is missing a section declaration", I cannot recall changing anything, so I don't know what caused it to appear, so this is just an FYI.
I searched and found lots of other posts that contributed to the final solution, below are the steps that solved it for me:
On your server:
Check if the %SystemRoot%\system32\inetsrv\rewrite.dll exists
If yes, open this config file in Admin mode: %SystemRoot%\System32\inetsrv\Config\applicationHost.config (for 64 bit Windows make sure to use a 64 bit text editor, or you will get a 'file not found' error`) and check if you have the following 'rewrite' elements (Parent elements provided for structural reference only)
<sectionGroup name="system.webServer"> <sectionGroup name="rewrite"> <section name="rules" overrideModeDefault="Allow" /> <section name="globalRules" overrideModeDefault="Deny" allowDefinition="AppHostOnly" /> <section name="outboundRules" overrideModeDefault="Allow" /> <section name="providers" overrideModeDefault="Allow" /> <section name="rewriteMaps" overrideModeDefault="Allow" /> <section name="allowedServerVariables" overrideModeDefault="Deny" /> </sectionGroup> <globalModules> <add name="Rewrite" image="%SystemRoot%\System32\inetsrv\rewrite.dll" preCondition="bitness64" /> <location path="" overrideMode="Allow"> <system.webServer> <modules> <add name="Rewrite" preCondition="bitness64" />
In my case every related part was missing in applicationHost.config, I had to add everything of the above. Saved the file, restarted IIS (may not be necessary but I had a luxury of doing it), clicked on the "URL Rewrite" icon again and the error was gone. After that I modified my website's web.config with the new section and it worked as expected.
User contributions licensed under CC BY-SA 3.0