title: ASP.NET dynamic compilation with multiple web servers
body: <p>Infrastructure:</p>
  
  <ul>
  <li>ASP.NET 4.6.1 website project (web forms)</li>
  <li>2 web servers behind a load balancer</li>
  <li>Redis on AWS as session state provider</li>
  </ul>
  
  <p>Issue:</p>
  
  <p>Dynamic compilation occurs on each server, creating temporary asp.net files that have different names. Sometimes a postback will hit a different server than the previous request and I get a <code>FileNotFoundException</code> - <code>Could not load file or assembly 'PageName.aspx.551d078a.agzxzct4</code>. This file exists on the first server, but not the second.</p>
  
  <p>Question:</p>
  
  <p>How can I deploy my web forms website project to multiple web servers and allow each request to hit any server?</p>
  
  <p>Ive tried:</p>
  
  <ul>
  <li>Precompiling with <code>aspnet_compiler</code>. I am using <code>VirtualPathProvider</code> so precompiling is out, per <a href="https://docs.microsoft.com/en-us/dotnet/api/system.web.hosting.virtualpathprovider?redirectedfrom=MSDN&amp;view=netframework-4.7.2" rel="nofollow noreferrer">these docs</a>. I get a 404 on pages that use <code>VirtualPathProvider</code></li>
  </ul>