The application domain restarts when the .resx file changes. Any way to avoid this?

I have an ASP.NET application with many .resx (resource) files that are used for localized user controls and pages.

We would like these files to be editable on the fly.

However, we noticed that editing these files on the web server causes the application domain to reboot, causing the server to slow down for about a minute while the application domain restarts.

Is there a way to allow editing of these files without causing a restart of the application domain?

+3
source share
2 answers

There are several variations of this question in Stackoverflow; repeat the answer, yes, it is definitely possible.

Like most .NET, resource providers are extensible.

I would say that the embedded resource providers (which compile .resx to .resources) are a bad mismatch for web-oriented deployments.

If your settings are mostly strings, you can connect a simple UpdatableResXResourceProvider that uses the built-in ResXResourceReader to read from existing * .resx files.

Results are cached in the application cache.

No assemblies are created - updates are immediately read in the same way as with any other file CacheDependency . At run time, any number of updates can be applied.

The only caveat is that if you do not want to disable the built-in FCNs, you need to move the * .resx files to the shielded folder App_Data strong> (trivially performed with a step after assembly).

You can download UpdatableResXResourceProvider here: http://www.onpreinit.com/2009/06/updatable-aspnet-resx-resource-provider.html

+7
source

This blog post should help you. I suspect this is:

The number of repeated compilations (aspx, ascx or asax) exceeds the limit specified by the installation in the machine.config or web.config file (by default, this value is 15)

+1
source

Source: https://habr.com/ru/post/895987/


All Articles