IIS7 Failed to grant minimum permission requests

33

I get this error when I'm using FileHelpers.dll, but my IIS is set to Full trust level so it should not be that way

That's the full stack trace:

    [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
permissions
asked on Stack Overflow Dec 4, 2009 by Omu

9 Answers

83

I had a similar problem when I rebuilt my dev machine with a clean Windows 7 install. After hunting around I discovered a solution that worked for me.

In your IIS application pool advanced settings, under "Process Model", set Load User Profile to true.

There are some other things to check like your trust level, but none of them applied to me (it was all full trust already on my dev machine). Setting the application pool to load user profile fixed it.

answered on Stack Overflow Dec 4, 2009 by Pat James
22

I've seen this error in another instance where, for example, IIS is running an application or virtual path via a UNC path (i.e. \\svr\share\folder). Even if Load User Profile=true I still got the PolicyException error. It was solved by running the Code Access Security Policy Tool (Caspol.exe) to add full trust to the UNC path. Since we had both 64 bit and 32 bit of .Net 2.x and .Net 4.x, I ran it in all four environments as follows:

%SystemRoot%\Microsoft.NET\Framework\v2.0.50727\caspol.exe -pp off -m -ag 1 -url "file:////\\svr\share\folder\*"   FullTrust -exclusive on
%SystemRoot%\Microsoft.NET\Framework\v4.0.30319\caspol.exe -pp off -m -ag 1 -url "file:////\\svr\share\folder\*"   FullTrust -exclusive on
%SystemRoot%\Microsoft.NET\Framework64\v2.0.50727\caspol.exe -pp off -m -ag 1 -url "file:////\\svr\share\folder\*"   FullTrust -exclusive on
%SystemRoot%\Microsoft.NET\Framework64\v4.0.30319\caspol.exe -pp off -m -ag 1 -url "file:////\\svr\share\folder\*"   FullTrust -exclusive on

Some notes of caution:

  • For .Net 4.x be sure to enable the NetFx40_LegacySecurityPolicy to true or the caspol.exe commands won't work as expected.
  • Do not add duplicate entries with caspol.exe for a given environment. Run the commands below to view your entries:

    %SystemRoot%\Microsoft.NET\Framework\v2.0.50727\caspol.exe -a -lg %SystemRoot%\Microsoft.NET\Framework64\v2.0.50727\caspol.exe -a -lg %SystemRoot%\Microsoft.NET\Framework\v4.0.30319\caspol.exe -a -lg %SystemRoot%\Microsoft.NET\Framework64\v4.0.30319\caspol.exe -a -lg

answered on Stack Overflow Mar 4, 2012 by Al Dass • edited Jul 7, 2017 by Al Dass
2

We had a similar issue with Windows 2008 R2 where our application would work fine in 64bit mode but when switched to 32 bit mode would cease to function and throw the permission error, turns out, in IIS7 under Advanced Settings >> Process Model >> the "Identity" setting had been switched to "Application Pool Identity" by default and may need changed to "Network Service" to work in 32 bit mode.

We did that and now we are humming along smoothly. Figured this tidbit of info may be the reason that everyone points to folder permissions, because technically it is a folder permission issue. But the change was in IIS and not the security settings on the folders themselves.

answered on Stack Overflow Dec 17, 2010 by Samuel Anderson
2

It appears that this is something of a generic Assembly will not load error. I appreciate all of the other posts since they became a list of possible sources of the error.

I found one more. I had tried all of the above with no success. I finally realized I was publishing the Web Application from Visual Studios Express 2008 with a Build Configuration of 'Debug'. After changing the Build Configuration to 'Release', the Web App worked.

Specifics: Visual Studios Express 2008 moving files to IIS7.5 on Win 2008 R2 server.

answered on Stack Overflow Sep 28, 2012 by watch_amajigger
1

I had similar problems, I solved the issue with following steps:

  1. Go to IIS.
  2. Right click on the website folder and see it's app pool.
  3. Right click on the app pool and go to advanced settings.
  4. In the process model section set load user profile to true
answered on Stack Overflow Nov 14, 2016 by Frankenstine Joe • edited Nov 14, 2016 by Andre Hofmeister
1

the problem her is belong to use ddl not trust for the SharePoint to solve the problem :

  1. open the IIS
  2. click on .net truest levels
  3. chose full(internal)
answered on Stack Overflow Jan 4, 2017 by AMustafa
1

This is a security/trust issue. Open the properties of the DLL in Windows Explorer. It's likely marked as blocked because it was downloaded it from the internet. Go to properties & click the "unblock" button and the problem may be solved.

enter image description here

answered on Stack Overflow Jan 28, 2020 by Vaibhav Jain
-1

Old question, but my answer was deleted because i have only posted a link.

maybe you will get this error: ERROR:

Could not load file or assembly ‘Microsoft.Practices.EnterpriseLibrary.Configuration.Design, Version=2.0.0.0, Culture=neutral, PublicKeyToken=null’ or one of its dependencies. Failed to grant minimum permission requests. (Exception from HRESULT: 0x80131417)

This error occurs because the default trust level for local machine is Full trust, but in the network share not.

So to compile your applications remotely you have to: Go to Control Panel ->Adiministrative Tools->Microsoft .NET Framework 2.0 Configuration Open My Computer->Runtime Security Policy ->Machine >Code Groups >All Code>New (right click to appear the menu to select New )

The URL field in the next figure is the path to the shared folder , in this case, but you can choose Strong Names( for .exe or .dll) etc

Click Finish and you can compile your app!!

https://medium.com/@marcoscavaleiro/failed-to-grant-minimum-permission-requests-7245cf694ebd

answered on Stack Overflow Jun 4, 2019 by marcos cavaleiro
-2

In your IIS 6.0 application pool advanced settings, under "Process Model", set Load User Profile to true.

There are some other things to check like your trust level, but none of them applied to me (it was all full trust already on my dev machine). Setting the application pool to load user profile fixed it.

that help to solve

required permissions cannot be acquired in iis to solve it..

answered on Stack Overflow Apr 1, 2014 by Suresh klt

User contributions licensed under CC BY-SA 3.0