title: TempData fails in a web farm
body: <p>When deployed to a web farm (basically 2 Windows Server 2016 boxes), the code below fails to read data from TempData.  The sequence of events is as follows: UserInfo page is POSTed to, TempData is set, then redirects to the GET of UserInfo.  In the GET TempData can't be read.</p>
  
  <pre><code>[HttpPost]
  public IActionResult UserInfo(Model model) {
      TempData["Model"] = JsonConvert.SerializeObject(model);
      return RedirectToAction("UserInfo");            
  }
  
  [HttpGet]
  public IActionResult UserInfo() {
      string serialized = (string)TempData["Model"];
      if (serialized != null) {
          var model = JsonConvert.DeserializeObject&lt;Model&gt;(serialized);
          return View(model);
      } else {
          // nothing here redirect home
          return RedirectToAction("Landing");
      }
  }
  </code></pre>
  
  <p>I get the following error in the std log (but doesn't cause an exception in my code):</p>
  
  <pre><code>warn: Microsoft.AspNetCore.Mvc.ViewFeatures.CookieTempDataProvider[3]
        The temp data cookie .AspNetCore.Mvc.CookieTempDataProvider could not be loaded.
  
  System.Security.Cryptography.CryptographicException: The key {0dd9c024-af79-407b-9820-db7f094975f9} was not found in the key ring.
     at Microsoft.AspNetCore.DataProtection.KeyManagement.KeyRingBasedDataProtector.UnprotectCore(Byte[] protectedData, Boolean allowOperationsOnRevokedKeys, UnprotectStatus&amp; status)
     at Microsoft.AspNetCore.DataProtection.KeyManagement.KeyRingBasedDataProtector.DangerousUnprotect(Byte[] protectedData, Boolean ignoreRevocationErrors, Boolean&amp; requiresMigration, Boolean&amp; wasRevoked)
     at Microsoft.AspNetCore.DataProtection.KeyManagement.KeyRingBasedDataProtector.Unprotect(Byte[] protectedData)
     at Microsoft.AspNetCore.Mvc.ViewFeatures.CookieTempDataProvider.LoadTempData(HttpContext context)
  </code></pre>
  
  <p>P.S. I should mention that this code works in non-web farm IIS instances and on Asure shared hosting.</p>