title: IIS Temporary file "Bad method token"
body: <p>In have stumbled upon a problem in production server where when IIS AppPool gets recycled the application starts giving error "Bad method token". It will give the error until the AppPool is restarted. The the file that is being reported in stacktrace is IIS generated file in "C:\WINDOWS\Microsoft.NET\Framework64\v4.0.30319\Temporary ASP.NET Files\root\". I have also observer situation where generated file gives error and then AppPool is restarted but no error after restart while same files is being served by IIS. The method that is being invoke in IIS TEMP file is <a href="https://docs.microsoft.com/en-us/dotnet/api/system.web.ui.page.processrequest?view=netframework-4.7.2" rel="nofollow noreferrer">Page.ProcessRequest(HttpContext)</a>. When AppPool is restarted it will work untill next recycle. The problem does not come up in development nor test machines. </p>
  
  <p>Message that I get in log:</p>
  
  <pre><code>Application_Error:
  System.BadImageFormatException: Bad method token.
     at ASP.page_aspx.ProcessRequest(HttpContext context)
     at System.Web.HttpApplication.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute()
     at System.Web.HttpApplication.ExecuteStepImpl(IExecutionStep step)
     at System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean&amp; completedSynchronously)
  </code></pre>
  
  <p>Application is ASP.NET webforms, build target is .NET framework 4.7.2 and all dll-s are MSIL (Any CPU).
  I am all out of ideas what may cause this. I am very grateful for any suggestions. (What to look, where to look, when to look)</p>