简体   繁体   中英

.Net Core WebApp API Endpoints don't work once deployed to Azure

I'm having an issue with deploying a WebApp / API to Azure.

When I run it locally on localhost:44385//api/user/getuser/1, it returns the JSON for that user, once deployed to an App Service on Azure, it starts returning a 404.

Its running on the free version as its for a uni assignment. I've spent hours poking around and reading, and cant seem to find where i've gone wrong in the setup. Hoping someone might of had a similar issue.

Have you checked to make sure the server's routing rules are correct and that it's not looking in the directory structure?

https://docs.microsoft.com/en-us/azure/application-gateway/url-route-overview#:~:text=In%20this%20article&text=URL%20Path%20Based%20Routing%20allows,to%20different%20backend%20server%20pools .

Please verify below points:

  1. That the Connection String of DB is correctly picked up by your Web API/it's correctly setup and configured.
  2. If the DB and table/collection is present when you query and if not then you are creating it through your code.
  3. If your data is present at the right place (User with ID = 1 in DB and collection/table you are querying) .
  4. If your code is not throwing 404 incorrectly (even in positive scenarios).

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM