title: AspNet Core using in memory repo for data protection when running in IIS
body: <p>I'm running a production server (Windows Server 2012) with an AspNet Mvc Core RC1 website.</p>
  
  <p>I'm seeing the following in the logs:</p>
  
  <pre><code>Neither user profile nor HKLM registry available. Using an ephemeral key repository. Protected data will be unavailable when application exits.
  </code></pre>
  
  <p>After inspecting the source code for <a href="https://github.com/aspnet/DataProtection/tree/1.0.0-rc1">DataProtection</a>, I tracked the problem to the following method call:</p>
  
  <pre><code>Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData)
  </code></pre>
  
  <p>This is probably returning null on the server for some reason. I don't have any special custom configuration in place and I've read the <a href="https://docs.asp.net/en/latest/security/data-protection/index.html">docs</a> so I thought the default would work.</p>
  
  <p>I think the problem is with the IIS website not running in a certain user's context but I have no idea how to confirm or fix this. My website is configured with its own pool.</p>
  
  <p><strong>As an aside:</strong> the result of running an in memory repository for storing keys causes them to recycle whenever the application exits which is very annoying and not even intended for use in production environments.</p>