LINQ error when deployed - Security Exception - cannot create DataContext

Posted by aximili on Stack Overflow See other posts from Stack Overflow or by aximili
Published on 2010-04-15T01:51:35Z Indexed on 2010/04/15 1:53 UTC
Read the original article Hit count: 553

Filed under:
|
|
|
|

The code below works locally, but when I deploy it to the server it gives the following error.

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.FileIOPermission, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089' failed.

The code is

protected void Page_Load(object sender, EventArgs e)
{
  DataContext context = new DataContext(Global.ConnectionString); // <-- throws the exception
  //Table<Group> _kindergartensTable = context.GetTable<Group>();

  Response.Write("ok");
}

I have set full write permissons on all files and folders on the server.

Any suggestions how to solve this problem? Thanks in advance.

© Stack Overflow or respective owner

Related posts about .NET

Related posts about LINQ