Ray
Ray

Reputation: 4929

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:\inetpub\wwwroot\GcsWeb\OnlineHelp\write.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.

Upvotes: 0

Views: 323

Answers (2)

samwu
samwu

Reputation: 5205

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

Upvotes: 1

JobesK
JobesK

Reputation: 347

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

Upvotes: 0

Related Questions