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.

(See http://www.tisgoud.nl/blog/CommentView,guid,79cd746e-556a-4417-a1fe-fb429bd37f80.aspx)

 

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.

 

Daniel

 

---

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=2.0.0.0, 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=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' failed.]

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

   System.Security.CodeAccessPermission.Demand() +59

   System.Configuration.BaseConfigurationRecord.CheckPermissionAllowed(String configKey, Boolean requirePermission, Boolean isTrustedWithoutAptca) +65

 

 

 

 

--------------------------------------------------------------------------------

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

Reply via email to