URL rewrite invalid child element under system.webServer in web.config

Tags

URL <rewrite> invalid child element in <system.webServer>

<system.webServer>
  <rewrite>
    <rules>
        <rule name=Main Rule stopProcessing=true>
        <match url=^((?!api).)*$ />
        <conditions logicalGrouping=MatchAll>
        <add input={REQUEST_FILENAME} matchType=IsFile negate=true />
        <add input={REQUEST_FILENAME} matchType=IsDirectory negate=true />
       </conditions>
       <action type=Rewrite url=/ />
     </rule>
   </rules>
</rewrite>

Production IIS server throw an error <rewrite> invalid child element in <system.webServer> .

Install URL Rewrite module tool on Server.

Read more about
http://www.iis.net/learn/extensions/url-rewrite-module/using-the-url-rewrite-module

More About URL ReWrite
http://www.iis.net/downloads?tabid=34&g=6&i=1691

Download Tool from
Download the x86 version of the URL Rewrite module
Download the x64 version of the URL Rewrite module

ReWrite will work on II7 or higher

Enjoy!!!