error when using filehelpers on IIS; sometimes : [PolicyException: Required permissions cannot be acquired.]

0

FileHelpers.dll are referenced within 2 class libraryies (Dto and Services) in my solution
My webapp (asp.net mvc) is on IIS7 (Full Trust) Windows 7 PRO 64 and I sometimes get this exception when starting my app from VS2008: (to get rid of it I delete the FileHelpers.dll from bin, run, close browser, rebuild the solution and run again )

     [PolicyException: Required permissions cannot be acquired.]
       System.Security.SecurityManager.ResolvePolicy(Evidence evidence, PermissionSet reqdPset, PermissionSet optPset, PermissionSet denyPset, PermissionSet& denied, Boolean checkExecutionPermission) +10238142
       System.Security.SecurityManager.ResolvePolicy(Evidence evidence, PermissionSet reqdPset, PermissionSet optPset, PermissionSet denyPset, PermissionSet& denied, Int32& securitySpecialFlags, Boolean checkExecutionPermission) +97

    [FileLoadException: Could not load file or assembly 'FileHelpers, Version=2.0.0.0, Culture=neutral, PublicKeyToken=3e0c08d59cc3d657' or one of its dependencies. Failed to grant minimum permission requests. (Exception from HRESULT: 0x80131417)]
       System.Reflection.Assembly._nLoad(AssemblyName fileName, String codeBase, Evidence assemblySecurity, Assembly locationHint, StackCrawlMark& stackMark, Boolean throwOnFileNotFound, Boolean forIntrospection) +0
       System.Reflection.Assembly.InternalLoad(AssemblyName assemblyRef, Evidence assemblySecurity, StackCrawlMark& stackMark, Boolean forIntrospection) +416
       System.Reflection.Assembly.InternalLoad(String assemblyString, Evidence assemblySecurity, StackCrawlMark& stackMark, Boolean forIntrospection) +166
       System.Reflection.Assembly.Load(String assemblyString) +35
       System.Web.Configuration.CompilationSection.LoadAssemblyHelper(String assemblyName, Boolean starDirective) +190

    [ConfigurationErrorsException: Could not load file or assembly 'FileHelpers, Version=2.0.0.0, Culture=neutral, PublicKeyToken=3e0c08d59cc3d657' or one of its dependencies. Failed to grant minimum permission requests. (Exception from HRESULT: 0x80131417)]
       System.Web.Configuration.CompilationSection.LoadAssemblyHelper(String assemblyName, Boolean starDirective) +11207304
       System.Web.Configuration.CompilationSection.LoadAllAssembliesFromAppDomainBinDirectory() +388
       System.Web.Configuration.CompilationSection.LoadAssembly(AssemblyInfo ai) +232
       System.Web.Configuration.AssemblyInfo.get_AssemblyInternal() +48
       System.Web.Compilation.BuildManager.GetReferencedAssemblies(CompilationSection compConfig) +210
       System.Web.Compilation.BuildProvidersCompiler..ctor(VirtualPath configPath, Boolean supportLocalization, String outputAssemblyName) +76
       System.Web.Compilation.ApplicationBuildProvider.GetGlobalAsaxBuildResult(Boolean isPrecompiledApp) +283
       System.Web.Compilation.BuildManager.CompileGlobalAsax() +50
       System.Web.Compilation.BuildManager.EnsureTopLevelFilesCompiled() +676

    [HttpException (0x80004005): Could not load file or assembly 'FileHelpers, Version=2.0.0.0, Culture=neutral, PublicKeyToken=3e0c08d59cc3d657' or one of its dependencies. Failed to grant minimum permission requests. (Exception from HRESULT: 0x80131417)]
       System.Web.Compilation.BuildManager.ReportTopLevelCompilationException() +76
       System.Web.Compilation.BuildManager.EnsureTopLevelFilesCompiled() +1012
       System.Web.Hosting.HostingEnvironment.Initialize(ApplicationManager appManager, IApplicationHost appHost, IConfigMapPathFactory configMapPathFactory, HostingEnvironmentParameters hostingParameters) +1025

[HttpException (0x80004005): Could not load file or assembly 'FileHelpers, Version=2.0.0.0, Culture=neutral, PublicKeyToken=3e0c08d59cc3d657' or one of its dependencies. Failed to grant minimum permission requests. (Exception from HRESULT: 0x80131417)]
   System.Web.HttpRuntime.FirstRequestInit(HttpContext context) +11301302
   System.Web.HttpRuntime.EnsureFirstRequestInit(HttpContext context) +88
   System.Web.HttpRuntime.ProcessRequestNotificationPrivate(IIS7WorkerRequest wr, HttpContext context) +4338644
iis
security
asked on Server Fault Dec 11, 2009 by Omu

1 Answer

0

Could it be the running order of the dependencies? Another option for your dev machine is to drop the dll into the GAC instead of having it local. That ensures that it runs as full trust.

My best guess for the trust error since you're running in full trust is that something in one of the dlls or in code is dropped down to partial trust at some point.

answered on Server Fault Dec 11, 2009 by Scott Forsyth - MVP

User contributions licensed under CC BY-SA 3.0