我们如何通过webapp url访问挂载的blob存储的内容到webapp

问题描述 投票:0回答:1

我已将 Blob 存储安装到 Web 应用程序。当我 ssh 进入 webapp 时,它会显示该容器的目录,在该目录中,我可以看到我在 blob 存储中上传的文件,但我想使用 webapp URL 访问这些文件

enter image description here

上图中显示了我将 blob 存储安装到 web 应用程序的位置和方式

我正在尝试使用 webapp URL 将已安装的 blob 存储的内容访问到 webapp

例如:

https://.azurewebsites.net//

我们可以从 /home/site/wwwroot/container-name 找到容器名称,它可以相同也可以不同,具体取决于我们在挂载路径中放置的内容

azure azure-blob-storage azure-webapps
1个回答
0
投票

要服务器静态文件或从 blob 上传的任何文件,您需要在 app.js 文件中定义路由。

  • 参考此 MSdoc 创建节点应用并将其部署到 Azure 应用服务。

  • 您的

    app.js
    默认服务于根目录

var  indexRouter  =  require('./routes/index');
app.use('/', indexRouter);
  • 您需要添加访问容器/任何特定文件夹的路由。

  • 您可以参考我为ASP.Net CORE应用程序解决的类似

    线程

  • app.js
    文件中添加以下代码行。

app.use('/containername', express.static('/home/site/wwwroot/containername'));

安装存储: enter image description here

从装载存储部署的文件夹: enter image description here

  • 还要确保访问级别不是公开的。

enter image description here

输出:

enter image description here

© www.soinside.com 2019 - 2024. All rights reserved.