【发布时间】:2016-06-26 10:42:18
【问题描述】:
我正在尝试在我的应用程序中实施“推荐”方法来存储凭据以连接到 Amazon S3,这似乎是使用已阅读此内容的凭据文件:
http://docs.aws.amazon.com/AWSSdkDocsNET/V3/DeveloperGuide/net-dg-config-creds.html
声明的地方:
Don't put literal access keys in your application, including the project's App.config or Web.config file.Doing so creates a risk of accidentally exposing your credentials if, for example, you upload the project to a public repository.
这很好,但所有示例都有 c:/path/to/my/file
那么我如何使这条路径相对于我的应用程序,而不是文字?
我有这个,但它不起作用:
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<configSections>
<section name="aws" type="Amazon.AWSSection, AWSSDK.Core"/>
</configSections>
<aws
profileName="Profile1"
profilesLocation="~/Credentials.json">
</aws>
...
</configuration>
这种方法对于已发布的应用程序来说不是正确的方法,并且只适合开发吗?
谢谢!
【问题讨论】:
-
应用程序在哪里运行?在 EC2 实例上?
-
它作为 Azure Web 服务运行 - 这是一个托管的 Web 服务器,我们无权访问文件系统..
标签: amazon-web-services amazon-s3 web-config app-config