Access to file write.lock in ASP.NET web application writing a Lucene search index

I created an ASP.NET application that uses Lucene for searching my web pages. Locally, everything works fine, but when I deploy it to the IIS server, the code that generates the write.lock file during the creation of the index, gives the following error:
Access to the path ‘C:inetpubwwwrootGcsWebOnlineHelpwrite.lock’ is denied.

I’m sure this has to do with the fact that the account under which the web app is running, does not have permission to write files to the web application folder.

How can I fix this? The file itself is not being created so I cannot right-click it and set the security permissions. It has to do with the fact that, maybe, it needs permission to write files, correct? If yes, then how do I do this? Not familiar with IIS security. Using IIS version 8.5 on Windows Server 2012 R2.

Answers:

Thank you for visiting the Q&A section on Magenaut. Please note that all the answers may not help you solve the issue immediately. So please treat them as advisements. If you found the post helpful (or not), leave a comment & I’ll get back to you as soon as possible.

Method 1

You need to find out from the application pool for the website what is the identity it is running under (by default this is Application Pool Identity) and grant that the correct permissions.

You can try this setting:

IIS > Application Pools > [your site] > Advanced Settings > Identity >
Built-in accound > LocalSystem

Method 2

Check the user identity running the IIS app (usually NETWORK SERVICE) and ensure that user has the proper rights to the applicable folders.


All methods was sourced from stackoverflow.com or stackexchange.com, is licensed under cc by-sa 2.5, cc by-sa 3.0 and cc by-sa 4.0

0 0 votes
Article Rating
Subscribe
Notify of
guest

0 Comments
Inline Feedbacks
View all comments
0
Would love your thoughts, please comment.x
()
x