dhont / elmah

Automatically exported from code.google.com/p/elmah
Apache License 2.0
0 stars 0 forks source link

Permissions Issue in Medium Trust Environments for Sqlite #92

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. Set the <trust level="Medium" /> configuration element in Web.config to
mimic a medium trust environment.

What is the expected output? 

No exception.

What do you see instead?

 Required permissions cannot be acquired.
Description: An unhandled exception occurred during the execution of the
current web request. Please review the stack trace for more information
about the error and where it originated in the code.

Exception Details: System.Security.Policy.PolicyException: Required
permissions cannot be acquired.

Source Error:

An unhandled exception was generated during the execution of the current
web request. Information regarding the origin and location of the exception
can be identified using the exception stack trace below.

Stack Trace:

[PolicyException: Required permissions cannot be acquired.]
   System.Security.SecurityManager.ResolvePolicy(Evidence evidence,
PermissionSet reqdPset, PermissionSet optPset, PermissionSet denyPset,
PermissionSet& denied, Boolean checkExecutionPermission) +7604211
   System.Security.SecurityManager.ResolvePolicy(Evidence evidence,
PermissionSet reqdPset, PermissionSet optPset, PermissionSet denyPset,
PermissionSet& denied, Int32& securitySpecialFlags, Boolean
checkExecutionPermission) +57

[FileLoadException: Could not load file or assembly 'System.Data.SQLite,
Version=1.0.44.0, Culture=neutral, PublicKeyToken=db937bc2d44ff139' or one
of its dependencies. Failed to grant minimum permission requests.
(Exception from HRESULT: 0x80131417)]
   System.Reflection.Assembly._nLoad(AssemblyName fileName, String
codeBase, Evidence assemblySecurity, Assembly locationHint, StackCrawlMark&
stackMark, Boolean throwOnFileNotFound, Boolean forIntrospection) +0
   System.Reflection.Assembly.nLoad(AssemblyName fileName, String codeBase,
Evidence assemblySecurity, Assembly locationHint, StackCrawlMark&
stackMark, Boolean throwOnFileNotFound, Boolean forIntrospection) +43
   System.Reflection.Assembly.InternalLoad(AssemblyName assemblyRef,
Evidence assemblySecurity, StackCrawlMark& stackMark, Boolean
forIntrospection) +127
   System.Reflection.Assembly.InternalLoad(String assemblyString, Evidence
assemblySecurity, StackCrawlMark& stackMark, Boolean forIntrospection) +142
   System.Reflection.Assembly.Load(String assemblyString) +28
   System.Web.Configuration.CompilationSection.LoadAssemblyHelper(String
assemblyName, Boolean starDirective) +46

[ConfigurationErrorsException: Could not load file or assembly
'System.Data.SQLite, Version=1.0.44.0, Culture=neutral,
PublicKeyToken=db937bc2d44ff139' or one of its dependencies. Failed to
grant minimum permission requests. (Exception from HRESULT: 0x80131417)]
   System.Web.Configuration.CompilationSection.LoadAssemblyHelper(String
assemblyName, Boolean starDirective) +613

System.Web.Configuration.CompilationSection.LoadAllAssembliesFromAppDomainBinDir
ectory()
+203
   System.Web.Configuration.CompilationSection.LoadAssembly(AssemblyInfo
ai) +105

System.Web.Compilation.BuildManager.GetReferencedAssemblies(CompilationSection
compConfig) +178
   System.Web.Compilation.BuildProvidersCompiler..ctor(VirtualPath
configPath, Boolean supportLocalization, String outputAssemblyName) +54

System.Web.Compilation.ApplicationBuildProvider.GetGlobalAsaxBuildResult(Boolean
isPrecompiledApp) +227
   System.Web.Compilation.BuildManager.CompileGlobalAsax() +52
   System.Web.Compilation.BuildManager.EnsureTopLevelFilesCompiled() +337

[HttpException (0x80004005): Could not load file or assembly
'System.Data.SQLite, Version=1.0.44.0, Culture=neutral,
PublicKeyToken=db937bc2d44ff139' or one of its dependencies. Failed to
grant minimum permission requests. (Exception from HRESULT: 0x80131417)]
   System.Web.Compilation.BuildManager.ReportTopLevelCompilationException() +58
   System.Web.Compilation.BuildManager.EnsureTopLevelFilesCompiled() +512
   System.Web.Hosting.HostingEnvironment.Initialize(ApplicationManager
appManager, IApplicationHost appHost, IConfigMapPathFactory
configMapPathFactory, HostingEnvironmentParameters hostingParameters) +729

[HttpException (0x80004005): Could not load file or assembly
'System.Data.SQLite, Version=1.0.44.0, Culture=neutral,
PublicKeyToken=db937bc2d44ff139' or one of its dependencies. Failed to
grant minimum permission requests. (Exception from HRESULT: 0x80131417)]
   System.Web.HttpRuntime.FirstRequestInit(HttpContext context) +8890735
   System.Web.HttpRuntime.EnsureFirstRequestInit(HttpContext context) +85

System.Web.HttpRuntime.ProcessRequestNotificationPrivate(IIS7WorkerRequest
wr, HttpContext context) +333

What version of the product are you using? On what operating system?

1.0.10617.936

Vista Ultimate

Please provide any additional information below.

Original issue reported on code.google.com by hammad.a...@gmail.com on 30 Apr 2009 at 1:48

GoogleCodeExporter commented 9 years ago
ELMAH runs fine in medium trust but the System.Data.SQLite assembly requires 
full
trust and unfortunately there's not much ELMAH can do about that.

For more information on which log stores are supported in medium trust or not, 
see
the table in the following section of the DNS article:

http://code.google.com/p/elmah/wiki/DotNetSlackersArticle#Enabling_and_configuri
ng_error_logging

Original comment by azizatif on 30 Apr 2009 at 7:35