ASP NET Core AWS No RegionEndpoint or ServiceURL configured when deployed to Heroku

冷暖自知 提交于 2021-01-29 06:07:07

问题


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

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"/>

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>();

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.

Thank you fin advance.


回答1:


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.



来源:https://stackoverflow.com/questions/61249683/asp-net-core-aws-no-regionendpoint-or-serviceurl-configured-when-deployed-to-her

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!