LINQ error when deployed - Security Exception - cannot create DataContext
- by aximili
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.