SecurityException using the MSFT Patterns & Practicecs Data Access Library

by

I’ve started using the (relatively new) Microsoft Enterprise Library for data access.  It’s nice.  I like it.  I’m using it on my current projects and migrating some of my existing applications over to it. 


Maybe this is me or maybe this is a deficiency in the documentation…I got it working on my dev workstation pretty easily.  Just run the installer and a batch script.  Done.  Works great. 


Well, then I deployed a new version of the application that I’m writing for a client to the demo server and BLAMMO!  Doesn’t work and the client notices.  (The client’s cool though so they didn’t lose their minds or anything.)  They’re getting an exception when they hit an ASPX page that makes any db calls:  “System.Security.SecurityException: Requested registry access is not allowed”


So…a little worshiping at the Altar Of St. Google and fat nothing…in English at least.  Found a post in German though.  Ran that through a translator and Voila! (note: I wish I knew how to say “Voila“ in German) the solution.  (I’ll post it here in English to save y’all the trouble.)


You need to add a bunch of registry keys to make it work.  You can do it by hand or just download this script, rename it to end in .reg and run it.


The German post seems to say that only the following key is required to make the Data Access portion work but my script adds keys for all the components in the Enterprise Library.


[HKEY_LOCAL_MACHINESYSTEMCurrentControlSetServicesEventlogApplicationEnterprise Library Data Service]
“EventMessageFile”=”C:\WINDOWS\Microsoft.NET\Framework\v1.1.4322\EventLogMessages.dll”


-Ben


Update (4/15/2005 5:57am) — I’m not sure why it happenned but the formatting got all messed up on this post.  Looked like it was authored by a crazy person.  Fixed it.  No longer crazy.


One Response to "SecurityException using the MSFT Patterns & Practicecs Data Access Library"

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.