We are calling System.IO.Packaging.Package.Open() in an ASP.NET application. Further, a Windows impersonation has been performed before calling this because the package to be opened is stored in a secure location and the impersonation is required in order to read it.
The problem is that Package.Open() calls EventTrace.EasyTraceEvent() which in turn calls MS.Utility.EventTrace.IsClassicETWRegistryEnabled() which throws a security exception of Requested registry access is not allowed.
This occurs even if is specifically disabled in Web.config . In both Debug and Release mode.
Thus my dilemma. The impersonation is required because the file (package) is stored such that it is only accessible by the impersonated account. Copying it to an insecure location would defeat the purpose of the security.
Granting the impersonated account access to the registry opens a security hole in the other direction. This account does not have nor otherwise need any access to any other system resources beyond a specific set of files and folders.
What I really want is for EventTrace to take a flying leap off a cliff, but I don't know how to tell it to do that.
Any ideas?