The default maximum limit is 250 KB. You can change this value by editing the registry key below (Reference). Make sure to restart the server after this change.
HKLM\SOFTWARE\Microsoft\InetStp\Configuration\MaxWebConfigFileSizeInKB
If you have hundreds of URL Rewrite rules, you can create rewrite maps and store them in a separate file.
Let’s say you have a rewrite map like the one below. Save it in a file called rewritemaps.config.
<rewriteMaps>
<rewriteMap name="Redirects">
<add key="/fromthisURL" value="/tothisURL" />
<add key="/fromthisURL2" value="/tothisURL2" />
</rewriteMap>
</rewriteMaps>
Then refer it from your web.config file:
<configuration>
<system.webServer>
<rewrite>
<rewriteMaps configSource="rewritemaps.config"><rewriteMaps>
<rule name="Redirect rule">
...
</rule>
</rewrite>
</system.webServer>
</configuration>
You can store rewrite rules themselves in a separate file as well:
<rules configSource="rewriteRules.config" />
Reference documents: Web.config file maximum size and count
If the answer is the right solution, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".
Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.