Marek M.
Marek M.

Reputation: 3951

Loading part of web.config from other file

Rewriter section is defined as follows: <section name="rewriter" requirePermission="false" type="Intelligencia.UrlRewriter.Configuration.RewriterConfigurationSectionHandler, Intelligencia.UrlRewriter" />

Then the <rewriter> element looks like that:

<rewriter>
    <if header="Host" match="^example.com">
      <redirect url="~/(.*)" to="http://www.example.com/$1" />
    </if>
    <!-- some other rules -->
</rewriter>

Now, I have roughly 2000 urls that I need to redirect to some other domain. My Web.config file is big enough on its own but when I've put those 2000 urls into it, I got: Cannot read configuration file because it exceeds the maximum file size error message. If I'd put this data into some other config file, then how can I reference it from Web.config?

My app is running on ASP.NET 2.0 and uses this package: https://www.nuget.org/packages/Intelligencia.UrlRewriter for url rewriting.

Upvotes: 0

Views: 89

Answers (1)

Nigrimmist
Nigrimmist

Reputation: 12338

As a variant you can change max size for web.config by tuning registry :)

HKLM\SOFTWARE\Microsoft\InetStp\Configuration\MaxWebConfigFileSizeInKB  (REG_DWORD)

Note If you configure IIS 7.0 and IIS 7.5 to run in 32-bit mode on Windows Server 2008 x64 or on Windows Server 2008 R2 x 64, the registry key is instead the following:

HKLM\SOFTWARE\Wow6432Node\Microsoft\InetStp\Configuration\MaxWebConfigFileSizeInKB (REG_DWORD)

Upvotes: 0

Related Questions