在哪里存储将为Azure上托管的asp.net中的环境变量引用的JSON文件 [英] Where to store the JSON file which will be referenced for the environment variable in asp.net hosted on Azure

本文介绍了在哪里存储将为Azure上托管的asp.net中的环境变量引用的JSON文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经使用ASP.NET创建了一个Web服务,并将在Firestore中存储数据.因此,我需要参考JSON文件设置GOOGLE_APPLICATION_CREDENTIALS环境变量.这在我的计算机上本地工作,但是在发布到Azure时不起作用.问题是我找不到JSON文件来定位文件路径,我在发布之前仔细检查了本地项目文件夹中是否存在JSON文件.我可以知道在哪里存储JSON文件的最佳位置,以便我可以找到文件路径,而GOOGLE_APPLICATION_CREDENTIALS可以在Azure门户中引用它.

I have created a Web Service using ASP.NET and will be storing data in Firestore. Hence, I will need to set the GOOGLE_APPLICATION_CREDENTIALS environment variable referring to a JSON file. This works locally on my machine, but it doesn't work when it's published to Azure. The problem is I couldn't find the JSON file to locate the file path, I have double checked my local project folder whether the JSON file is in there before publishing. May I know where is the best place to store my JSON file, so that I can locate the file path and GOOGLE_APPLICATION_CREDENTIALS can refer to it in the Azure Portal.

谢谢.

推荐答案

如果您的json文件在发布时在项目中,则它将上传到 D:\ home \ site \ wwwroot \ xxx.json .您可以转到 https://yourwebname.scm.azurewebsites.net 进行查找.

If your json file is in project when publishing it, it will be uploaded to D:\home\site\wwwroot\xxx.json. You could go to https://yourwebname.scm.azurewebsites.net to find it.

因此,您可以在门户网站的 Application settings 中设置环境变量,如下所示:

So, you could set the environment variable in Application settings on portal as below:

这篇关于在哪里存储将为Azure上托管的asp.net中的环境变量引用的JSON文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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