none
Required Permission Caanot be Acquired Error

    Question

  • Hello - I get this error when I try to run web applicaiton. I checked the trusts and full trust has been given.

    This is running on Windows 2003 server with .net 2.0 with Sept CTP / RC1 and Team foundation beta 3

    I have reporoduced the error below.

    __________________________

    Required permissions cannot be acquired.

    Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

    Exception Details: System.Security.Policy.PolicyException: Required permissions cannot be acquired.

    Source Error:

    An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.

    Stack Trace:

    [PolicyException: Required permissions cannot be acquired.] System.Security.SecurityManager.ResolvePolicy(Evidence evidence, PermissionSet reqdPset, PermissionSet optPset, PermissionSet denyPset, PermissionSet& denied, Boolean checkExecutionPermission) +2735877 System.Security.SecurityManager.ResolvePolicy(Evidence evidence, PermissionSet reqdPset, PermissionSet optPset, PermissionSet denyPset, PermissionSet& denied, Int32& securitySpecialFlags, Boolean checkExecutionPermission) +57 [FileLoadException: Could not load file or assembly 'Microsoft.Practices.EnterpriseLibrary.ExceptionHandling, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null' 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) +211 System.Reflection.Assembly.InternalLoad(String assemblyString, Evidence assemblySecurity, StackCrawlMark& stackMark, Boolean forIntrospection) +141 System.Reflection.Assembly.Load(String assemblyString) +25 System.Web.Configuration.CompilationSection.LoadAssemblyHelper(String assemblyName, Boolean starDirective) +32 [ConfigurationErrorsException: Could not load file or assembly 'Microsoft.Practices.EnterpriseLibrary.ExceptionHandling, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null' or one of its dependencies. Failed to grant minimum permission requests. (Exception from HRESULT: 0x80131417)] System.Web.Configuration.CompilationSection.LoadAssemblyHelper(String assemblyName, Boolean starDirective) +596 System.Web.Configuration.CompilationSection.LoadAllAssembliesFromAppDomainBinDirectory() +3478009 System.Web.Configuration.CompilationSection.LoadAssembly(AssemblyInfo ai) +46 System.Web.Compilation.BuildManager.GetReferencedAssemblies(CompilationSection compConfig) +177 System.Web.Compilation.BuildProvidersCompiler..ctor(VirtualPath configPath, Boolean supportLocalization, String outputAssemblyName) +180 System.Web.Compilation.CodeDirectoryCompiler.GetCodeDirectoryAssembly(VirtualPath virtualDir, CodeDirectoryType dirType, String assemblyName, StringSet excludedSubdirectories, Boolean isDirectoryAllowed) +347 System.Web.Compilation.BuildManager.CompileCodeDirectory(VirtualPath virtualDir, CodeDirectoryType dirType, String assemblyName, StringSet excludedSubdirectories) +125 System.Web.Compilation.BuildManager.EnsureTopLevelFilesCompiled() +378 [HttpException (0x80004005): Could not load file or assembly 'Microsoft.Practices.EnterpriseLibrary.ExceptionHandling, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null' or one of its dependencies. Failed to grant minimum permission requests. (Exception from HRESULT: 0x80131417)] System.Web.Compilation.BuildManager.ReportTopLevelCompilationException() +57 System.Web.Compilation.BuildManager.EnsureTopLevelFilesCompiled() +612 System.Web.Hosting.HostingEnvironment.Initialize(ApplicationManager appManager, IApplicationHost appHost, IConfigMapPathFactory configMapPathFactory, HostingEnvironmentParameters hostingParameters) +452 [HttpException (0x80004005): Could not load file or assembly 'Microsoft.Practices.EnterpriseLibrary.ExceptionHandling, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null' or one of its dependencies. Failed to grant minimum permission requests. (Exception from HRESULT: 0x80131417)] System.Web.HttpRuntime.FirstRequestInit(HttpContext context) +3425523 System.Web.HttpRuntime.EnsureFirstRequestInit(HttpContext context) +88 System.Web.HttpRuntime.ProcessRequestInternal(HttpWorkerRequest wr) +149 

    thanks



    Tuesday, October 18, 2005 6:20 AM

Answers

  • That error means that an assembly is trying to load which has an assembly level RequestMinimum security set specified.  The CLR security policy was not going to grant that assembly what it had asked for in it's minimum grant set, so the assembly was not loaded and that exception was thrown.

    You'll need to find which assembly is failing to load and check it's minimum request set (either by looking for .permissionset reqmin in ILDasm, or if it's a v1.1 assembly by using PermView), and see why your policy is not granting it those permissions.

    -Shawn

    Tuesday, October 18, 2005 4:09 PM
    Moderator

All replies

  • hi xanthus..i think your problem is related to Enterprise Library files..Please check the execution path if this dll is present..

    'Microsoft.Practices.EnterpriseLibrary.ExceptionHandling, Version=1.0.0.0'

    hope this helps..Smile

    regards,

    andro
    Tuesday, October 18, 2005 7:40 AM
  • Hi,

    The dll is prsent in the Bin directory

    Regards
    Sahil
    Tuesday, October 18, 2005 11:53 AM
  • Hi,

    I get the error reproduced below.

    The machine config - TFS Beta3 - RC1 - Sept CTP.

    Note: I do not get this error - when running the application where TFS is not installed. I have put this on my local webserver - it works fine.

    Tried it on another machine - where TFS is not installed - works fine.

    Any Idea what might be the issue here.

    An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.

    Stack Trace:

    [PolicyException: Required permissions cannot be acquired.] System.Security.SecurityManager.ResolvePolicy(Evidence evidence, PermissionSet reqdPset, PermissionSet optPset, PermissionSet denyPset, PermissionSet& denied, Boolean checkExecutionPermission) +2735877 System.Security.SecurityManager.ResolvePolicy(Evidence evidence, PermissionSet reqdPset, PermissionSet optPset, PermissionSet denyPset, PermissionSet& denied, Int32& securitySpecialFlags, Boolean checkExecutionPermission) +57 [FileLoadException: Could not load file or assembly 'Microsoft.Practices.EnterpriseLibrary.ExceptionHandling, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null' 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) +211 System.Reflection.Assembly.InternalLoad(String assemblyString, Evidence assemblySecurity, StackCrawlMark& stackMark, Boolean forIntrospection) +141 System.Reflection.Assembly.Load(String assemblyString) +25 System.Web.Configuration.CompilationSection.LoadAssemblyHelper(String assemblyName, Boolean starDirective) +32 [ConfigurationErrorsException: Could not load file or assembly 'Microsoft.Practices.EnterpriseLibrary.ExceptionHandling, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null' or one of its dependencies. Failed to grant minimum permission requests. (Exception from HRESULT: 0x80131417)] System.Web.Configuration.CompilationSection.LoadAssemblyHelper(String assemblyName, Boolean starDirective) +596 System.Web.Configuration.CompilationSection.LoadAllAssembliesFromAppDomainBinDirectory() +3478009 System.Web.Configuration.CompilationSection.LoadAssembly(AssemblyInfo ai) +46 System.Web.Compilation.BuildManager.GetReferencedAssemblies(CompilationSection compConfig) +177 System.Web.Compilation.BuildProvidersCompiler..ctor(VirtualPath configPath, Boolean supportLocalization, String outputAssemblyName) +180 System.Web.Compilation.CodeDirectoryCompiler.GetCodeDirectoryAssembly(VirtualPath virtualDir, CodeDirectoryType dirType, String assemblyName, StringSet excludedSubdirectories, Boolean isDirectoryAllowed) +347 System.Web.Compilation.BuildManager.CompileCodeDirectory(VirtualPath virtualDir, CodeDirectoryType dirType, String assemblyName, StringSet excludedSubdirectories) +125 System.Web.Compilation.BuildManager.EnsureTopLevelFilesCompiled() +378 [HttpException (0x80004005): Could not load file or assembly 'Microsoft.Practices.EnterpriseLibrary.ExceptionHandling, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null' or one of its dependencies. Failed to grant minimum permission requests. (Exception from HRESULT: 0x80131417)] System.Web.Compilation.BuildManager.ReportTopLevelCompilationException() +57 System.Web.Compilation.BuildManager.EnsureTopLevelFilesCompiled() +612 System.Web.Hosting.HostingEnvironment.Initialize(ApplicationManager appManager, IApplicationHost appHost, IConfigMapPathFactory configMapPathFactory, HostingEnvironmentParameters hostingParameters) +452 [HttpException (0x80004005): Could not load file or assembly 'Microsoft.Practices.EnterpriseLibrary.ExceptionHandling, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null' or one of its dependencies. Failed to grant minimum permission requests. (Exception from HRESULT: 0x80131417)] System.Web.HttpRuntime.FirstRequestInit(HttpContext context) +3425523 System.Web.HttpRuntime.EnsureFirstRequestInit(HttpContext context) +88 System.Web.HttpRuntime.ProcessRequestInternal(HttpWorkerRequest wr) +149 

    Thanks
    Sahil
    Tuesday, October 18, 2005 2:54 PM
  • xanthus: I have merged your second thread with your original thread, so all information about this problem will be in the same location.
    Tuesday, October 18, 2005 3:30 PM
    Moderator
  • That error means that an assembly is trying to load which has an assembly level RequestMinimum security set specified.  The CLR security policy was not going to grant that assembly what it had asked for in it's minimum grant set, so the assembly was not loaded and that exception was thrown.

    You'll need to find which assembly is failing to load and check it's minimum request set (either by looking for .permissionset reqmin in ILDasm, or if it's a v1.1 assembly by using PermView), and see why your policy is not granting it those permissions.

    -Shawn

    Tuesday, October 18, 2005 4:09 PM
    Moderator
  • hi r u using sharepoint if soo add that trust level coding in the parent webconfig file

     

    • Proposed as answer by Petr Kadlec Tuesday, January 12, 2010 11:27 AM
    Tuesday, September 18, 2007 4:43 AM
  • Dear

    I am really very thankful to you,
    your suggestion is working

    ;)
    Thursday, October 08, 2009 1:10 PM
  • Hello Manthan,

    Which suggestion worked for you?  I am using the microsoft chart control and I am getting the following error:

    Required permissions cannot be acquired.

    Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

    Exception Details: System.Security.Policy.PolicyException: Required permissions cannot be acquired.

    Source Error:

    An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.


    Stack Trace:

     

    [PolicyException: Required permissions cannot be acquired.]

       System.Security.SecurityManager.ResolvePolicy(Evidence evidence, PermissionSet reqdPset, PermissionSet optPset, PermissionSet denyPset, PermissionSet& denied, Boolean checkExecutionPermission) +7606579

       System.Security.SecurityManager.ResolvePolicy(Evidence evidence, PermissionSet reqdPset, PermissionSet optPset, PermissionSet denyPset, PermissionSet& denied, Int32& securitySpecialFlags, Boolean checkExecutionPermission) +57

     

    [FileLoadException: Could not load file or assembly 'WebChart, Version=1.1.1.4, Culture=neutral, PublicKeyToken=null' 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.nLoad(AssemblyName fileName, String codeBase, Evidence assemblySecurity, Assembly locationHint, StackCrawlMark& stackMark, Boolean throwOnFileNotFound, Boolean forIntrospection) +43

       System.Reflection.Assembly.InternalLoad(AssemblyName assemblyRef, Evidence assemblySecurity, StackCrawlMark& stackMark, Boolean forIntrospection) +127

       System.Reflection.Assembly.InternalLoad(String assemblyString, Evidence assemblySecurity, StackCrawlMark& stackMark, Boolean forIntrospection) +142

       System.Reflection.Assembly.Load(String assemblyString) +28

       System.Web.Configuration.CompilationSection.LoadAssemblyHelper(String assemblyName, Boolean starDirective) +46


    Does anyone know what this means?
    Monday, February 01, 2010 6:43 PM
  • Dear All,

    I am having the same problem as stated by the pervious post by lmg3rd . To let you know that I am having this problem while running a SharePoint web application. Should I change the web.config file for the web application in virtual directory of the web application or web.config in the 12 hive? or should I change  Please help me out in this regard?

    Thanks in advance.

    Sami
    Tuesday, March 02, 2010 2:47 PM
  • Dear All,

     I have transferred a web application with content database from one MOSS machine to another. when I try to run the application it gives the following error:

    Server Error in '/' Application.
    --------------------------------------------------------------------------------

    The specified module could not be found. (Exception from HRESULT: 0x8007007E)
    Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

    Exception Details: System.IO.FileNotFoundException: The specified module could not be found. (Exception from HRESULT: 0x8007007E)

    Source Error:

    An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below. 

    Stack Trace:


    [FileNotFoundException: The specified module could not be found. (Exception from HRESULT: 0x8007007E)]
       System.Reflection.Assembly._nLoad(AssemblyName fileName, String codeBase, Evidence assemblySecurity, Assembly locationHint, StackCrawlMark& stackMark, Boolean throwOnFileNotFound, Boolean forIntrospection) +0
       System.Reflection.Assembly.nLoad(AssemblyName fileName, String codeBase, Evidence assemblySecurity, Assembly locationHint, StackCrawlMark& stackMark, Boolean throwOnFileNotFound, Boolean forIntrospection) +43
       System.Reflection.Assembly.InternalLoad(AssemblyName assemblyRef, Evidence assemblySecurity, StackCrawlMark& stackMark, Boolean forIntrospection) +127
       System.Reflection.Assembly.InternalLoad(String assemblyString, Evidence assemblySecurity, StackCrawlMark& stackMark, Boolean forIntrospection) +142
       System.Reflection.Assembly.Load(String assemblyString) +28
       System.Web.Configuration.CompilationSection.LoadAssemblyHelper(String assemblyName, Boolean starDirective) +46

    [ConfigurationErrorsException: The specified module could not be found. (Exception from HRESULT: 0x8007007E)]
       System.Web.Configuration.CompilationSection.LoadAssemblyHelper(String assemblyName, Boolean starDirective) +613
       System.Web.Configuration.CompilationSection.LoadAllAssembliesFromAppDomainBinDirectory() +203
       System.Web.Configuration.CompilationSection.LoadAssembly(AssemblyInfo ai) +105
       System.Web.Compilation.BuildManager.GetReferencedAssemblies(CompilationSection compConfig) +178
       System.Web.Compilation.BuildProvidersCompiler..ctor(VirtualPath configPath, Boolean supportLocalization, String outputAssemblyName) +54
       System.Web.Compilation.CodeDirectoryCompiler.GetCodeDirectoryAssembly(VirtualPath virtualDir, CodeDirectoryType dirType, String assemblyName, StringSet excludedSubdirectories, Boolean isDirectoryAllowed) +8809426
       System.Web.Compilation.BuildManager.CompileCodeDirectory(VirtualPath virtualDir, CodeDirectoryType dirType, String assemblyName, StringSet excludedSubdirectories) +128
       System.Web.Compilation.BuildManager.CompileResourcesDirectory() +31
       System.Web.Compilation.BuildManager.EnsureTopLevelFilesCompiled() +304

    [HttpException (0x80004005): The specified module could not be found. (Exception from HRESULT: 0x8007007E)]
       System.Web.Compilation.BuildManager.ReportTopLevelCompilationException() +58
       System.Web.Compilation.BuildManager.EnsureTopLevelFilesCompiled() +512
       System.Web.Hosting.HostingEnvironment.Initialize(ApplicationManager appManager, IApplicationHost appHost, IConfigMapPathFactory configMapPathFactory, HostingEnvironmentParameters hostingParameters) +729

    [HttpException (0x80004005): The specified module could not be found. (Exception from HRESULT: 0x8007007E)]
       System.Web.HttpRuntime.FirstRequestInit(HttpContext context) +8890735
       System.Web.HttpRuntime.EnsureFirstRequestInit(HttpContext context) +85
       System.Web.HttpRuntime.ProcessRequestInternal(HttpWorkerRequest wr) +259

    Does anyone know about this error: please help me out?

    Thanks in Advance

    Sami

    Wednesday, March 03, 2010 8:29 AM