Azure API returning 204 No Content for Db-Calls with content

Viewed 407

My setup: SQL Server database, .NET 5 Web API (with Angular 11 front-end) app.

Azure resources: Azure SQL Server, Azure SQL database, Web Apps for the front- and backend and API Management Service.

The issue: when I try to call the Azure SQL database from myapi.azurewebsites.net/api/dbObject, I get a "HTTP 204 No Content" error.

Diagnosis: when using localDb and localHost, everything works as expected.
When I connect the Azure database to my localHost, I can read & write from & to database.

When I call myapi.azurewebsites.net/api/test, I get two test strings returned, as intended.

But when I call myapi.azurewebsites.net/api/dbObject/{id}, a "204 No Content" is returned.

It should return the dbObject with the given id, as it does on localhost, but it's not happening

Db is up and running in the Cloud and so is the API.

What configuration could I be missing? And how could I find out myself?

What do I need the Gateway Url & Developer portal URL for in Azure?

And what Url should I use for database calls? azurewebsites.net where the app is hosted or api-mngr.azure-api.net where the app is managed?

In API Management Service, I've added an API and a version.
For testing I've added a get operation to api/test.
I've designed it to call azurewebsites.net/api/test (as is the web service url; front-end and back-end, without In- or Outbound processing), but when I Test that call I see an address myapp-api-mngr.azure-api.net/api/test as request URL, with a host also pointing to that baseUrl. Do I need to configure something between that web service and the myapp-api-mngr.azure-api.net/ Url? How come that request URL is different from what I configured in Design?

Could not find similar questions here.

Thanks for input!

1 Answers

Got it working by using the connectionstring from Properties in visual studio's SQL Server Object Explorer (right-click on the Azure SQL Server) instead of the one proposed by Azure upon creating the Db.

A bit silly, but there you have it.

Related