我遵循this教程,一切似乎都在本地工作正常,但是当我在Azure上托管我的网络应用程序并尝试安装/访问文件存储时,我得到了#34;访问被拒绝"但我确信我的证书是正确的,因为他们在本地工作。在天蓝色的环境中是否有额外的东西(auth wise)?
我怀疑这与本教程使用的天体环境中可能无法使用的dll有关,如果这是问题链接/提示我将如何解决将非常感激。
值得一提的是: Web应用程序和文件存储都位于azure的同一区域。谢谢!
答案 0 :(得分:1)
正如David Makogon所说,Azure文件卷无法安装到Azure Web App。
像这样的docs.microsoft.com/en-us/rest/api/storageservices / ...是否合适?
如果我们想要在Azure文件存储中操作文件。我建议你可以使用Azure文件存储SDK来做到这一点。我们也可以从Develop for Azure Files with .NET获得演示代码。
CloudFileClient fileClient = storageAccount.CreateCloudFileClient();
// Get a reference to the file share we created previously.
CloudFileShare share = fileClient.GetShareReference("logs");
// Ensure that the share exists.
if (share.Exists())
{
// Get a reference to the root directory for the share.
CloudFileDirectory rootDir = share.GetRootDirectoryReference();
// Get a reference to the directory we created previously.
CloudFileDirectory sampleDir = rootDir.GetDirectoryReference("CustomLogs");
// Ensure that the directory exists.
if (sampleDir.Exists())
{
// Get a reference to the file we created previously.
CloudFile file = sampleDir.GetFileReference("Log1.txt");
// Ensure that the file exists.
if (file.Exists())
{
// Write the contents of the file to the console window.
Console.WriteLine(file.DownloadTextAsync().Result);
}
}
}