title: How to write in registry from ASP.NET App in IIS?
body: <p>I try to write in the Registry.LocalMachine from an asp.net app. I use the following code, and it works on my development machine :</p>
  
  <pre><code>string value = "some value";
  RegistryKey clefDeRegistre = Registry.LocalMachine;
  RegistryKey clefTapi = clefDeRegistre.OpenSubKey(@"SOFTWARE\SomeEditor\MySubKey", true);
  if (clefTapi != null)
      {
          clefTapi.SetValue("Options", value);
      }
  </code></pre>
  
  <p>But when I try this on my server (Windows Server 2008 R2), it doesn't work.</p>
  
  <p>With the default app pool settings, I received a security exception when trying to write in the registry. So I changed the app pool identity to LocalSystem.</p>
  
  <p>Now I don't receive any exception, but the key isn't modified.</p>
  
  <p>It looks like a problem with <a href="https://msdn.microsoft.com/en-us/library/aa965884%28v=vs.85%29.aspx" rel="nofollow">Registry Virtualization</a>, but I don't understand how I can disable it.</p>