Alexis Chavarría
Alexis Chavarría

Reputation: 37

Deployed API returning bad requests status code

I developed a simple API using .Net core and it locally works as intended. After deployment only the WeatherForecast endpoint is working and the rest results in status 500. I have used code first with EF and enabled migrations during the publish process through VS code. Any suggestion?

Azure gives me these errors but I am not really familiar with Azure

image 1

my code

endpoint

EDIT: The endpoints are working now, but as I said in a comment below I changed my local db connection string (see my appsettings.json in git) by the one that azure gives me and everything is working correctly but, if you have alredy filled you db with many records probably that's not the entire solution

Upvotes: 0

Views: 228

Answers (1)

Ramee Ahmed
Ramee Ahmed

Reputation: 11

Looking into your code, I see that you have added connection string of the localdb. Did you update this in configuration on app service?

I am pretty sure that your application is unable to connect to the database and hence the 500 : internal server error

Also you should add appsettings to .gitignore so that it is not pushed to a remote public repository.

Upvotes: 0

Related Questions