问题
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