Solve Application Insights error in Umbraco
When adding Application Insights to a clients App Service a site breaking error was unexpectedly thrown. The error read:
The process cannot access the file 'D:\home\site\wwwroot\App_Data\TEMP\PluginCache\umbraco-plugins.RD0003FF8F3E23.hash' because it is being used by another process.
The solution was to simply delete the file mentioned in the error message.
For the production environment I tried deleting the files beforehand in order to skip the error message entirely, but that was unfortunately not possible. You have to activate Application Insights to the App Service and then you can delete the file(s) (You can delete the entire content of the folder if you want to).
I did this for the dev/test environment first and allowed the site to run for a day or two to see if the error would reappear when the temporary file it complained about would get regenerated. The error did not reappear.
So, when activating Application Insights for your website, keep in mind that an error message can be thrown. But now you know how to fix it!