In the web.config there is an array of items - only 2
More often than not it reads all the elements correcting in the automatic pool recycling (which seems to be daily).
Every so often, the array wont read all the elements.
I'm going to add another key so I've got a check on the number of items, but I'm not quite sure what to do about it when the problem occurs. To fix it, we recycle the application pool again, and that will re-read it, and generally get it correct.
The array is read from web.config by:
NameValueCollection nvcDbKeys = nvcDbKeys = NameValueCollection)ConfigurationManager.GetSection("MyArray");
With the array being a simple keyvalue
<MyArray>
<add key="prod1" value="user1"/>
<add key="prod2" value="user2"/>
<add key="prod3" value="user3"/>
</MyArray>
The I enter into a for loop to store the values. This code is called the first time the web method is called as a static initiator.
I can throw an exception, but would prefer to force a re-read if the counter doesn't match the number of array entries.
Can I just re-read the array, or do I need to force an application pool recycle via code?