部署到Heroku时未配置ASP NET Core AWS的RegionEndpoint或ServiceURL [英] ASP NET Core AWS No RegionEndpoint or ServiceURL configured when deployed to Heroku

查看:94
本文介绍了部署到Heroku时未配置ASP NET Core AWS的RegionEndpoint或ServiceURL的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我将我的WEB API项目部署到了​​Heroku,但遇到了AWS异常未配置RegionEndpoint或ServiceURL"

Hi I deployed my WEB API project to Heroku but I get an AWS exception 'No RegionEndpoint or ServiceURL configured'

我试图在heroku的应用程序环境变量中添加"region"和"aws_default_region",并将它们设置为"eu-north-1",但这并没有帮助.另外,我将这些行添加到配置下的web.config文件中,但仍然出现该异常:

I tried to add 'region' and 'aws_default_region' to heroku's app enviromental variables and set them to 'eu-north-1' but it didn't help. Also I added these lines to my web.config file under configuration but I still get that exception:

<appSettings>
    <add key="AWSRegion" value="eu-north-1"/>
</appSettings>
<aws region="eu-north-1"/>

由于无法在启动类中创建服务,因此无法创建自己的aws客户端并以编程方式设置区域:

I can't create my own aws client and set the region programatically since I am creating the service in my startup class like so:

services.AddAWSService<IAmazonS3>();

在本地版本中,似乎我只是将'region'添加到了我的.aws/crediantials文件中,并且可以工作,但是我无法在Heroku中做到这一点.

In local build it seems I just added 'region' to my .aws/crediantials file and it worked, but I can't do that in Heroku.

谢谢前进.

推荐答案

好像您正在构建一个ASP.NET Core应用程序,除了某些IIS集成之外,该应用程序不使用web.config.您应该将区域放在如下所示的appsettings.json文件中:

Looks like you are building a ASP.NET Core application which doesn't use web.config other then some IIS integration. You should either put the region in the appsettings.json file like shown here https://aws.amazon.com/blogs/developer/configuring-aws-sdk-with-net-core/ or set the environment variable AWS_REGION to your desired region.

这篇关于部署到Heroku时未配置ASP NET Core AWS的RegionEndpoint或ServiceURL的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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