title: Security Exception WCF
body: <p>i have a website that up and running.
  today, as usual, i did a simple change in the Service, re-compiled it and upload it to production. then, i got a strange Security Exception saying:</p>
  
  <pre><code>Server Error in '/' Application.
  
  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.Security.Permissions.ReflectionPermission, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089' 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.Security.Permissions.ReflectionPermission, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089' failed.]
     System.Security.CodeAccessSecurityEngine.Check(Object demand, StackCrawlMark&amp; stackMark, Boolean isPermSet) +0
     System.Security.CodeAccessSecurityEngine.Check(CodeAccessPermission cap, StackCrawlMark&amp; stackMark) +31
     System.Security.CodeAccessPermission.Demand() +46
     System.Reflection.Emit.DynamicMethod.PerformSecurityCheck(Module m, StackCrawlMark&amp; stackMark, Boolean skipVisibility) +248
     System.Reflection.Emit.DynamicMethod..ctor(String name, Type returnType, Type[] parameterTypes, Module m, Boolean skipVisibility) +49
     System.Runtime.Serialization.CodeGenerator.BeginMethod(Type returnType, String methodName, Type[] argTypes, Boolean allowPrivateMemberAccess) +53
     System.Runtime.Serialization.CodeGenerator.BeginMethod(String methodName, Type delegateType, Boolean allowPrivateMemberAccess) +131
     System.Runtime.Serialization.CriticalHelper.GenerateClassReader(ClassDataContract classContract) +141
  
  Version Information: Microsoft .NET Framework Version:4.0.30319; ASP.NET Version:4.0.30319.272
  </code></pre>
  
  <p>I looked for a solution, and found many links but neither of them worked.
  i have no clue where this bug came from, out of nowhere...
  just for your information - the change was just adding a field to entity framework.</p>
  
  <p>after 6 hours i gave up and posted here the problem.</p>
  
  <p>any ideas?</p>