如何声明`GOOGLE_APPLICATION_CREDENTIALS`环境变量?

时间:2018-05-02 14:34:54

标签: windows google-cloud-platform environment-variables credentials google-speech-api

我正在PC上尝试QuickStart project .NET Google Cloud Speech API示例(使用Visual Studio 2017的Windows),但我无法确定我必须定义GOOGLE_APPLICATION_CREDENTIALS的位置必须包含JSON帐户密钥文件的路径。

当我在Visual Studio 2017中运行该项目时,它在此异常上失败:

  

System.InvalidOperationException: 'The Application Default Credentials are not available. They are available if running in Google Compute Engine. Otherwise, the environment variable GOOGLE_APPLICATION_CREDENTIALS must be defined pointing to a file defining the credentials. See https://developers.google.com/accounts/docs/application-default-credentials for more information.'

我试图在系统属性中定义GOOGLE_APPLICATION_CREDENTIALS环境变量(在用户变量系统变量下),如下所示:

C:\GCP_ApiKey\MyFirstProject-599bf9a10431.json

但它没有用。

我在哪里定义GOOGLE_APPLICATION_CREDENTIALS

1 个答案:

答案 0 :(得分:0)

事实上,我只需重新启动PC就可以考虑环境变量......

相关问题