views:

629

answers:

2

I have implemented a custom section in my app.config file and am accessing it using ConfigurationSection and ConfigurationElement. When the application starts all data is retrieved correctly. If I manually change the values in the app.config file then my application later calls ConfigurationManager.RefreshSection I still receive the original values not the updated ones.

Am I misunderstanding how RefreshSection functions?

<configSections>
    <section name="OrderProcessorSettings" type="OrderProcessor.Configuration.OrderProcessor.OrderProcessorConfigHandler, RDC.BL.OrderProcessor" />
</configSections>

<OrderProcessorSettings>
    <OrderBlock OrderCheckInterval = "1000" />
</OrderProcessorSettings>



System.Configuration.ConfigurationManager.RefreshSection("OrderProcessorSettings");
            OrderProcessorConfigHandler config = (OrderProcessorConfigHandler)System.Configuration.ConfigurationManager.GetSection("OrderProcessorSettings");

this.OrderCheckInterval = config.OrderBlock.OrderCheckInterval;
A: 

Having the same problem. However, after some testing, I've noticed that during that Request's lifecycle, the config isn't re-read, but on the next request, the config is re-read and I get the updated values.

Anyone have ANY idea on how to get the config to be re-read during the same request lifecycle?

By the way, I'm using this for a web application, but the principal is the same.

Mike Nicol
If you have a follow up question and can provide some more informationabout the problem you should post it asa new question, not as an answer to this old question.More people will read it since old questions are not frequented very much.In the top right is an "Ask Question" button to do so.
sth
Apologies, will do.
Mike Nicol
A: 

Same problem here, ConfigurationManager.RefreshSection() works for non-web applications. But does not work for web config files. WebConfigurationManager does not have a RefreshSection method.

Guest