title: "PolicyException: Required permissions cannot be acquired" in Full Trust — can't see why
body: <p>This is a two-part question, of sorts.</p>
  
  <p>I'm trying to set up a new part of our Production (Live) hosting architecture, so I'm trying to point our Staging webserver to the new Production content share (a UNC path on another server in the same subnet).</p>
  
  <p>I'm currently getting the dreaded <em>PolicyException: Required permissions cannot be acquired</em> message.</p>
  
  <ul>
  <li>The user context has Modify rights over the full hierarchy of the contents share.</li>
  <li>I have added <code>&lt;trust level="Full" originUrl="" /&gt;</code> to the Web.config (and I'm pretty sure it was already the case, ayway)</li>
  <li>I have <a href="https://stackoverflow.com/a/9552246/205245">run <code>caspol</code></a> — see below</li>
  <li>I have <a href="https://stackoverflow.com/a/1848756/205245">checked the AppPool settings</a> — the Identity is set to the appropriate username and Load User Profile is set to True</li>
  <li>I have only just set up the content share and the IIS site, so I know the usernames and passwords are all in sync (and I did double-check).</li>
  </ul>
  
  <p>More confusing is that the assembly that's complaining is one of our internal code libraries. Decompiling it in <a href="http://wiki.sharpdevelop.net/ILSpy.ashx" rel="nofollow noreferrer">ILSpy</a>, I can see a reference to</p>
  
  <pre class="lang-cs prettyprint-override"><code>[assembly: SecurityPermission(SecurityAction.RequestMinimum,
     SkipVerification = true)]
  </code></pre>
  
  <p>, except I don't remember ever adding any code-access security into that assembly. None of the classes that reference <code>Security</code> has anything declarative in it and certainly no reference to <a href="http://msdn.microsoft.com/en-us/library/ms998326.aspx#paght000017_wrappingprivilegedcode" rel="nofollow noreferrer">AllowPartiallyTrustedCallersAttribute or CodeAccessPermission.Assert</a>.</p>
  
  <p>I have full administrative access to all the servers involved (both the webserver and the server holding the content share).</p>
  
  <p>So how do I make this problem go away?</p>
  
  <p>(And can we turn <a href="https://stackoverflow.com/questions/1846816/iis7-failed-to-grant-minimum-permission-requests">question #1846816</a> into a community wiki with all the possible answers in, rather than having to read zillions of questions with undescriptive titles and far too many hits on Google?  ;o)</p>
  
  <hr>
  
  <p><strong>Edit:</strong> The (edited) output from <code>caspol -a -lg</code> is as follows:</p>
  
  <pre class="lang-none prettyprint-override"><code>Microsoft (R) .NET Framework CasPol 2.0.50727.4016
  Copyright (c) Microsoft Corporation.  All rights reserved.
  
  Security is ON
  Execution checking is ON
  Policy change prompt is OFF
  
  Level = Enterprise
  
  Code Groups:
  
  1.  All code: FullTrust
  
  Level = Machine
  
  Code Groups:
  
  1.  All code: Nothing
     1.1.  Zone - MyComputer: FullTrust
        1.1.1.  StrongName - [snip]: FullTrust
        1.1.2.  StrongName - [snip]: FullTrust
     1.2.  Zone - Intranet: LocalIntranet
        1.2.1.  All code: Same site Web
        1.2.2.  All code: Same directory FileIO - 'Read, PathDiscovery'
        1.2.3.  Url - file://[some other my UNC share]\*: FullTrust
        1.2.4.  Url - [THIS UNC SHARE]\*: FullTrust
        1.2.5.  Url - [some other my UNC share]:\*: FullTrust
        1.2.6.  Url - file://[THIS UNC SHARE]\*: FullTrust
     1.3.  Zone - Internet: Internet
        1.3.1.  All code: Same site Web
     1.4.  Zone - Untrusted: Nothing
     1.5.  Zone - Trusted: Internet
        1.5.1.  All code: Same site Web
  
  Level = User
  
  Code Groups:
  
  1.  All code: FullTrust
  Success
  </code></pre>