I am trying to load some dll's into a MEF DirectoryCatalog within an ASP.NET MVC application:
var catalog = new DirectoryCatalog(HttpRuntime.BinDirectory, "Toptable.Mobile.*.dll");
When I run the app through the Cassini web server (i.e. F5) everything runs fine however when hosted 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 globally and I have set the trust level in web.config (system.web/trust) to Full. Running out of ideas about what could be causing it. Any suggestions?