Web应用无法访问已安装的存储帐户共享 [英] Mounted storage account share is not accessible to web app

查看:64
本文介绍了Web应用无法访问已安装的存储帐户共享的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我们的Azure帐户中有一个名为"SmithsIntranet"的网络应用程序。该应用的公共网址为


smithsintranet.azurewebsites.net


 


  我已经安装了一个名为"data"的文件共享在我们的存储帐户中,如此处所述的网络应用程序 -


docs.microsoft.com/en-us/cli/azure/webapp/config/storage-account?view= azure-cli-latest#az-webapp-config-storage-account-add


 


az webapp config storage-account add -g Smiths -n SmithsIntranet -i Data -t AzureFiles -a smithsdata --share-name data -k my_access_key == --mount-path / data


 


据我所知,文件共享应该可以公开访问


smithsintranet.azurewebsites。 net / data /


我说错了吗?我在该共享中有一个文件 - mytest.txt。但是,当我尝试访问它时


smithsintranet.azurewebsites.net/data/mytest.txt


我收到404"未找到"错误。有什么问题?

解决方案

嗨Brian5577,


使用SMB文件共享时Azure,所有目录和文件都必须在父共享中创建。


- mount-path<容器内的路径,您希望远程共享映射到的地方>


您是否将父份额添加到口径?当您将存储帐户链接到Web应用程序时,您的输出是什么?显示正确路径的输出是什么?


查看
此博客



az webapp config storage-account add -g AppSvcDemoSite -n AppSvcBYOSDemoSite -custom-id MediaVolume -storage-type AzureBlob -account-name appsvcbyosdemo -share-name mediablob -access-key< youraccesskey> - mount-path / var / media



输出:



{

" MediaVolume":{
$
" accessKey":" youraccesskey",$
" accountName":" appsvcbyosdemo",

" mountPath":" / var / media",

" shareName":" mediablob",

" state" ;:" Ok",$
" type":" AzureBlob"

}

}



完成此操作后,Web应用程序将在/ var / media上安装存储,并且Web应用程序可以完全访问此存储。


如果要在多容器Web应用程序中使用已安装的存储帐户, 您需要在Docker-Compose或Kubernetes yaml文件的容器定义的volume块中指定存储帐户的
custom-id ,例如:



版本:'3'

服务:

web:

image:"mydocker / image:最新的"

端口:

- "80:80"

卷:

- < custom-id> ;:/ var / media

redis:

image:"redis:alpine"



希望有所帮助。


如果您有其他问题或疑虑,请告诉我们。




We have a web app in our Azure account called "SmithsIntranet". The public URL of the app is

smithsintranet.azurewebsites.net

 

 I have mounted a file share called "data" in our storage account to the web app as described here -

docs.microsoft.com/en-us/cli/azure/webapp/config/storage-account?view=azure-cli-latest#az-webapp-config-storage-account-add

 

az webapp config storage-account add -g Smiths -n SmithsIntranet -i Data -t AzureFiles -a smithsdata --share-name data -k my_access_key== --mount-path /data

 

As I understand the file share should be accessible publicly as

smithsintranet.azurewebsites.net/data/

Am I correct? I have a file in that share - mytest.txt. However, when I try to access it as

smithsintranet.azurewebsites.net/data/mytest.txt

I get a 404 "not found" error. What is the problem?

解决方案

Hi Brian5577,

When using an SMB file share in Azure, all directories and files must be created in a parent share.

--mount-path <path inside your container to where you want the remote share to be mapped>

Are you adding the parent share to the mouth-path? When you link your storage account to your web app what is your output? is the output showing the right path?

Looking at the example from this blog:


az webapp config storage-account add -g AppSvcDemoSite -n AppSvcBYOSDemoSite –custom-id MediaVolume –storage-type AzureBlob –account-name appsvcbyosdemo –share-name mediablob –access-key <youraccesskey> –mount-path /var/media

Output:

{
"MediaVolume": {
"accessKey": "youraccesskey",
"accountName": "appsvcbyosdemo",
"mountPath": "/var/media",
"shareName": "mediablob",
"state": "Ok",
"type": "AzureBlob"
}
}

After this is done, the web application will have the storage mounted at /var/media and the web application has full access to this storage.

If you want to use the mounted storage account in a Multi-container web app,  you need to specify the custom-id of your storage account in the volumes block of your container definition in the Docker-Compose or Kubernetes yaml file, for example:

version: ‘3’
services:
web:
image: "mydocker/image:latest"
ports:
– "80:80"
volumes:
– <custom-id>:/var/media
redis:
image: "redis:alpine"

Hope that helps.

Please let us know if you have further questions or concerns.



这篇关于Web应用无法访问已安装的存储帐户共享的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆