LinkDemand error on webserver when using TraceSource
        Posted  
        
            by robertpnl
        on Stack Overflow
        
        See other posts from Stack Overflow
        
            or by robertpnl
        
        
        
        Published on 2010-04-30T09:17:30Z
        Indexed on 
            2010/05/03
            10:18 UTC
        
        
        Read the original article
        Hit count: 837
        
Hi,
On a webserver (shared hosting provider) I published a website with a ADO.Net Framework model in use with MySql Connector 6.3.1. When I request a page, a Security Exception will be happen with this error messages:
"LinkDemand The type of the first permission that failed was: System.Security.Permissions.SecurityPermission The Zone of the assembly that failed was: MyComputer ".
This exception raised when code collect the listeners of a tracksource:
public class MySqlTrace
{
  private static TraceSource source = new TraceSource("mysql");
  static MySqlTrace()
  {
    foreach (TraceListener listener in source.Listeners) // <-- Exception throw here
    {    // ... }
  }
}
The web.config doesn't have any trace data or system.diagnostics.
My question is, why will a get a LinkDemand security exception during collecting the source listeners. What can maybe be wrong in here?
© Stack Overflow or respective owner