Hi @Michèle Merlo,
If the size of the Web.config file exceeds the threshold, IIS will refuse to read it, and the configuration system will generate the error "The configuration file cannot be read because it exceeds the maximum file size". The maximum size of web.config allowed by default is 250KB.
You can change the registry key HKLM\SOFTWARE\Microsoft\InetStp\Configuration\MaxWebConfigFileSizeInKB
to allow a larger web.config
. If the value of this key is changed, the process must be restarted. Please refer to this link for more information.
Besides that, there is another way to manage large web.config file. You can create rewrite maps and store them in separate files. For example, if you have a rewrite map like below, please 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 reference 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 also store rewrite rules in a separate file and then reference it:
<rules configSource="rewriteRules.config" />
Just like the web.config
file, the rewritemaps.config
and rewriteRules.config
files also have a size limit of 250 KB.
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 email notification for this thread.
Best regards,
Yurong Dai