views:

306

answers:

2

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

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

However, we have noticed that editing these files on the web server causes the app domain to reload, which causes the server to slow down for about a minute while the app domain restarts.

Is there any way to permit editing of these files without causing the app domain to restart?

+1  A: 

This blog post should help you out. I suspect its this:

The number of re-compilations (aspx, ascx or asax) exceeds the limit specified by the setting in machine.config or web.config (by default this is set to 15)

rick schott
I am concerned about upping the value for numRecompilesBeforeAppRestart. As described here http://blogs.msdn.com/tess/archive/2006/08/02/asp-net-case-study-lost-session-variables-and-appdomain-recycles.aspx#9896689...it will consume more memory. We need RAM for caching in our application, so I don't think it will scale very well.
frankadelic
I agree, I don't thinks this is a best practice. You might be able to do some assembly loading trough your application instead so they become available instead of a re-compile.
rick schott
+2  A: 

There are several flavors of this question on Stackoverflow; to repeat the answer, yes, it's definitely possible.

Like much of .NET, resource providers are extendable.

I would argue that the built-in resource providers (that compile .resx to .resources) are an unfortunate mismatch for web-centric deployments.

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

The results are cached in the application cache.

No assemblies are generated – updates are immediately read just as they would be with any other file-based CacheDependency – any number of updates can be applied at run-time.

The only caveat is that if you don’t want to disable built-in FCNs, you have to move the *.resx files to the shielded App_Data folder (trivially done with a post-build step).

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

Nariman