I am trying to load some dll into the MEF DirectoryCatalog directory in an ASP.NET MVC application:
var catalog = new DirectoryCatalog(HttpRuntime.BinDirectory, "Toptable.Mobile.*.dll");
When I run the application through the Cassini web server (i.e. F5), everything works fine, but when placed in IIS (7) I get the following exception:
[SecurityException: Request for the permission of type 'System.Security.Permissions.FileIOPermission, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089' failed.] System.Security.CodeAccessSecurityEngine.Check(Object demand, StackCrawlMark& stackMark, Boolean isPermSet) +0 System.Security.CodeAccessPermission.Demand() +54 System.IO.Path.GetFullPath(String path) +193 System.ComponentModel.Composition.Hosting.DirectoryCatalog.GetFullPath(String path) +267 System.ComponentModel.Composition.Hosting.DirectoryCatalog.Initialize(String path, String searchPattern) +144 System.ComponentModel.Composition.Hosting.DirectoryCatalog..ctor(String path, String searchPattern) +166 Toptable.Mobile.MvcApplication.Application_Start() in C:\Dev\Toptable\Toptable.Mobile\Toptable.Mobile.Web\Global.asax.cs:74
The .NET trust levels for the application are set to "Full" both for the site and around the world, and I set the trust level in web.config (system.web / trust) to Full. Launching ideas on what might be causing this. Any suggestions?
source share