PolicyException on Windows 7 x64

Topics: Support Request
Nov 13, 2009 at 4:59 AM

I have copied the latest web files into a c:\inetpub\wwwroot\blog dir, configured the site security and config files, created vdir/app and pointed at my blog folder, given "Network Service" modify perms on content, logs and siteConfig.  When I try to access the blog site I get this error at the bottom of the stack trace:

[HttpException (0x80004005): Could not load file or assembly 'DotNetOpenId, Version=2.4.3.8264, Culture=neutral, PublicKeyToken=2780ccd10d57b246' 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

When creating the vdir/app I stuck with all the default settings.  What am I missing?  I did this on another x64 system (workgroup though whereas this new machine is on a domain) and I don't remeber the trick I did.  Also I think that version was pre-DotNetOpenId.  The trick had something to do with the ApplicationPoolIdentity but I don't remember the specifics.  BTW the rate at which IIS management is changing is starting to get annoying.  Back in XP a web site/app *used* to be simple to configure and manage.  Grrr.

Nov 13, 2009 at 6:42 AM
Edited Nov 13, 2009 at 8:43 PM

OK, figured out the reason for the exception - since I unzipped the Web Files into that dir, all the DLLs needed to be unblocked.  Sigh...  Anyway, now I can see the site but can't edit.  I know there's something else I need to WRT to ApplicationPoolIdentity:

In IIS 7 the app pools use the applicationpoolidentity. You'll have to give this account the appropriate right.

The way I fixed this before was just choose "Network Service" for the App Pool's identity. But the help text says that using ApplicationPoolIdentity is recommended.  Yet I find no account for AppicationPoolIdentity to add to the three dirs - giving it modify perms.  What's the right way to do this?

Jun 27, 2010 at 10:47 PM

I am getting the same error.  Everything I can find says this is a medium trust problem.  But the lastest version is supposed to run under medium trust?  I unblocked all the DLLs - but it still reports this same error.  Anyone know what steps I missing?  I am trying to get this to work on Windows 7 64 bit - this is my test environment - eventually I want to install it in a medium trust environment on my webhost.

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) +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 'DotNetOpenId, Version=2.4.3.8264, Culture=neutral, PublicKeyToken=2780ccd10d57b246' 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 'DotNetOpenId, Version=2.4.3.8264, Culture=neutral, PublicKeyToken=2780ccd10d57b246' 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 'DotNetOpenId, Version=2.4.3.8264, Culture=neutral, PublicKeyToken=2780ccd10d57b246' 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 'DotNetOpenId, Version=2.4.3.8264, Culture=neutral, PublicKeyToken=2780ccd10d57b246' 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