title: How to handle Lucene's "System.UnauthorizedAccessException - segments.gen" in an Azure WebApp?
body: <p>Umbraco 7.1.8 running as an Azure web app has yo'yo'ed a couple of times, the logs show the following error message:</p>
  
  <pre><code>ClassName": "System.UnauthorizedAccessException",
  "Message": "Access to the path 'D:\\home\\site\\wwwroot\\App_Data\\TEMP\\ExamineIndexes\\Internal\\Index\\segments.gen' is denied.
  </code></pre>
  
  <p>There is a very large stack trace I won't paste just yet, however it's starting with </p>
  
  <pre><code>at Lucene.Net.Store.SimpleFSDirectory.OpenInput(String name, Int32 bufferSize)   
  at Lucene.Net.Store.FSDirectory.OpenInput(String name)
  </code></pre>
  
  <p>No one has accessed any of the site files directly during the crashes FYI, nor has anything other than Umbraco content edit based changes / cache updates been made (though maybe they are key to the issue?)</p>
  
  <p>Question is, is this a lock of some kind created by the website (umbraco e.g. during a publish / cache update) or is this something systematic with Azure / Web Apps / Server Setup / IIS that could cause segments.gen to lock / access denied? It's strange that it worked after a while with no intervention.</p>
  
  <p>Any insight appreciated, if not to simply help work out the issue by deduction.</p>