If I am only reading the registry (not updating) is it necessary to close the registry key ? The code in question is in a data access component that gets hit pretty hard from the .aspx pages. Here is my code
What type of error would I see if I am not closing it
We had our production IIS site crash yesterday and needed MS to help us get it back up. Turned out that the account "Network Service" lost it's permissions to read the registry. Couldn't get the site to come backup. MS suggested adding read access at the hklm level for "Network Service". Made the change and it worked. Now I am trying to figure out what caused the crash
----- George Ter-Saakov wrote: ----
Yes
You must explicitly close any object that works with a system
Like RegestryKey, File, Socket,...
George
jzink said:
If I am only reading the registry (not updating) is it necessary to clos
get it back up. Turned out that the account "Network Service" lost it's
permissions to read the registry. Couldn't get the site to come backup. MS
suggested adding read access at the hklm level for "Network Service". Made
the change and it worked. Now I am trying to figure out what caused the
crash.
My understanding is that Open registry key is a windows Handle.
You can see how many windows handles process has open by using task manager.
View/SelectColumns/HandleCount.
But this number includes every handle (open files )
Theoretically no.
But nobody knows what can happens when program stops working correctly.
If it crashed when server was updating the registry then it could got
corrupted.