views:

20

answers:

2

I have a WPF application which uses LINQ-to-SQL to access an .MDF file within its local directory structure. This works fine.

However, when I create a second .MDF file in the same directory as the first, and try to create a model with Entity Framework, it gives me this error:

Request for the permission of type 'System.Web.AspNetHostingPermission'

What kind of extra settings to I have to make so that the Entity Framework classes can access a local .MDF file as does the LINQ-to-SQL classes?

+1  A: 

I found the answer: there is a link on the error box that says "add permissions to this application", you just have to click it and restart.

Edward Tanguay
A: 

It sounds like a trust issue. It may be related to how you refer to the MDF in the Entity Framework with regards to path. If that's the case be sure to use the ~ to refer to the relative MDF path so that it resolves as the trust-level expects.

Turnkey