Share via


Partial Trust MVC, LINQ and OLE/ODBC Providers

So if you're a hosting provider or even just developer, you'll be running your applications in Medium trust when on the Internet, right? suuurree... Well you really should..

Anyway a couple people have noticed some issues running LINQ in their hosted environments under the "Medium" trust level. If this is your issue, then you'll need to update your trust config file with with the following (remembering to install asp.net 3.5 first..) :

In the SecurityClasses element, make sure it's set to the following:

<SecurityClass Name="ReflectionPermission" Description="System.Security.Permissions.ReflectionPermission, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"/>

Then dig about for the "ASP.net" PermissionSet element and set the following:

<IPermission class="ReflectionPermission" version="1" Flags="RestrictedMemberAccess" />

A few people also have asked about getting OLE/ODBC providers for the likes of MS Access to work, weelllll this has been around since ASP.NET 2.0 was released - and basically the same story as above:

Set the SecurityClass element:

<SecurityClass Name="OleDbPermission" Description="System.Data.OleDb.OleDbPermission, System.Data, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"/>

and set the IPermission in the PermissionSet

<IPermission class="OleDbPermission" version="1" Unrestricted="true"/>

That should fix the LINQ and OLE/ODBC issue. All I can say for MVC, at this stage its still waiting a couple of updates to allow partial trust. Keep an eye out on Scottgu blog and you should see something soon.

-jorke

Technorati Tags: ASP.NET,mvc,linq,partial trust,trust,cas