无法使用 Lucene.Net 和 Azure 应用服务访问 Azure 存储
Can't access to Azure Storage using Lucene.Net And Azure App Service
我们使用 Lucene.Net 实现了搜索,索引存储在 Azure 存储文件夹中,几天前我们将 Web 应用程序从 Azure CloudService 移动到 Azure AppService。
如果我们 运行 这在本地它按预期工作,也在 CloudService 中工作但是当我们将 Web 应用程序发布到 Azure AppService 时
我们有以下异常:
System.UnauthorizedAccessException: Access to the path 'D:\AzureDirectory' is denied.
已尝试更新 AzureDirectory 和 Azure 存储包,但没有成功。
有什么想法吗?
您没有 d:\
访问权限。在 Web Apps 中,您的应用位于 d:\home
(更准确地说是 d:\home\site
)下。
此外 - 仅供参考,这不是 "Azure Storage" - 该术语指的是 blob 存储。
tried to update AzureDirectory
正如 David Makogon 提到的,在 Azure WebApp 中,我们无权创建或访问 D:\AzureDirectory 文件夹。我们可以从 Azure WebApp Sandbox 获得更多信息。以下是文档
的片段
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.
根据您提到的异常,似乎某些代码想要访问文件夹 D:\AzureDirectory 但它不存在于 Azure WebApp 中。我们也可以在 Azure 中远程调试我们的 WebApp 来找到相关代码,更多细节请参考 Remote debugging web apps.
谢谢,
解决方案是将 Lucene.Net.Store.Azure.AzureDirectory
s CacheDirectory
路径更改为 D:/Home/AzureDirectory
AzureDirectory(cloudStorageAccount, containerName, FSDirectory.Open(new DirectoryInfo("D:/Home/AzureDirectory")))
正如你提到的,我没有 d:\
访问权限
我们使用 Lucene.Net 实现了搜索,索引存储在 Azure 存储文件夹中,几天前我们将 Web 应用程序从 Azure CloudService 移动到 Azure AppService。 如果我们 运行 这在本地它按预期工作,也在 CloudService 中工作但是当我们将 Web 应用程序发布到 Azure AppService 时 我们有以下异常:
System.UnauthorizedAccessException: Access to the path 'D:\AzureDirectory' is denied.
已尝试更新 AzureDirectory 和 Azure 存储包,但没有成功。
有什么想法吗?
您没有 d:\
访问权限。在 Web Apps 中,您的应用位于 d:\home
(更准确地说是 d:\home\site
)下。
此外 - 仅供参考,这不是 "Azure Storage" - 该术语指的是 blob 存储。
tried to update AzureDirectory
正如 David Makogon 提到的,在 Azure WebApp 中,我们无权创建或访问 D:\AzureDirectory 文件夹。我们可以从 Azure WebApp Sandbox 获得更多信息。以下是文档
的片段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.
根据您提到的异常,似乎某些代码想要访问文件夹 D:\AzureDirectory 但它不存在于 Azure WebApp 中。我们也可以在 Azure 中远程调试我们的 WebApp 来找到相关代码,更多细节请参考 Remote debugging web apps.
谢谢,
解决方案是将 Lucene.Net.Store.Azure.AzureDirectory
s CacheDirectory
路径更改为 D:/Home/AzureDirectory
AzureDirectory(cloudStorageAccount, containerName, FSDirectory.Open(new DirectoryInfo("D:/Home/AzureDirectory")))
正如你提到的,我没有 d:\
访问权限