logging-log4net-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Daniel Miller" <daniel.mil...@corp.idt.net>
Subject ASP .NET 2.0 Security error - Config problems - Any ideas?
Date Thu, 29 Jun 2006 06:50:28 GMT
Hi there


I'm using log4net with an ASP .NET 2.0 application. On my local machine all
works well, but when deployed to an ISP, there are no logs.


After much debugging, I discovered that log4net was failing on a "Security
Error" (see error message below) - i.e., the server's trust level is Medium
and blocks log4net from reading the config data. (When I used a separate
log4net.config file this error was swallowed; it only showed up when I moved
the config data to web.config).


After much searching online, still no hope in sight (the trust level cannot
be overridden for this server) and some claim there is no solution.



Any ideas? Suggestions? 


I've tried loading configuration data from Global.asax (using
XmlConfigurator.Configure(),XmlConfigurator. ConfigureAndWatch(.), and the
same for DOMConfigurator) and also using AssemblyInfo.cs ([assembly:
log4net.Config.XmlConfigurator(ConfigFile="log4net.config",Watch=true )]),
you name it.


Thanks in advance. 





Error message:


Security Exception 

Description: The application attempted to perform an operation not allowed
by the security policy.  To grant this application the required permission
please contact your system administrator or change the application's trust
level in the configuration file. 


Exception Details: System.Security.SecurityException: Request for the
permission of type 'System.Configuration.ConfigurationPermission,
System.Configuration, Version=, Culture=neutral,
PublicKeyToken=b03f5f7f11d50a3a' failed.


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: 



[SecurityException: Request for the permission of type
'System.Configuration.ConfigurationPermission, System.Configuration,
Version=, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' failed.]

   System.Security.CodeAccessSecurityEngine.Check(Object demand,
StackCrawlMark& stackMark, Boolean isPermSet) +0

   System.Security.CodeAccessPermission.Demand() +59

configKey, Boolean requirePermission, Boolean isTrustedWithoutAptca) +65






Version Information: Microsoft .NET Framework Version:2.0.50727.42; ASP.NET

View raw message