Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Can't access to Azure Storage using Lucene.Net And Azure App Service

We Have search implemented using Lucene.Net, Indexes are stored in Azure Storage Folder, Few days ago we moved our Web Application From Azure CloudService To Azure AppService. If we run this locally it works as expected, also works in CloudService But when we published our Web Application to Azure AppService we have below Exception:

System.UnauthorizedAccessException: Access to the path 'D:\AzureDirectory' is denied.

tried to update AzureDirectory and Azure Storage packages but it's not working.

Any Idea?

like image 559
Irakli Gabisonia Avatar asked Jul 16 '17 21:07

Irakli Gabisonia


3 Answers

Thanks, Solution was to change Lucene.Net.Store.Azure.AzureDirectory s CacheDirectory path to D:/Home/AzureDirectory

AzureDirectory(cloudStorageAccount, containerName, FSDirectory.Open(new DirectoryInfo("D:/Home/AzureDirectory")))

As you mentioned I had no d:\ access

like image 180
Irakli Gabisonia Avatar answered Nov 05 '22 05:11

Irakli Gabisonia


tried to update AzureDirectory

As David Makogon mentioned that in the Azure WebApp, we have no access to create or access D:\AzureDirectory folder. We could get more info from the Azure WebApp Sandbox. The following is the snippet from the document

File System Restrictions/Considerations

Applications are highly restricted in terms of their access of the file system.

Home directory access (d:\home)

Every Azure Web App has a home directory stored/backed by Azure Storage. This network share is where applications store their content. This directory is available for the sandbox with read/write access.

According to the exception you mentioned, it seems that some code want to access the folder D:\AzureDirectory but it is not existed in the Azure WebApp. We also could remote debug our WebApp in the Azure to find the related code, more details please refer to the Remote debugging web apps.

like image 22
Tom Sun - MSFT Avatar answered Nov 05 '22 07:11

Tom Sun - MSFT


You don't have d:\ access. In Web Apps, your app lives under d:\home (more accurately d:\home\site).

Also - fyi this isn't "Azure Storage" - that term refers to blob storage.

like image 1
David Makogon Avatar answered Nov 05 '22 06:11

David Makogon