简体   繁体   English

.Net Core WebApp API 端点一旦部署到 Azure 就不起作用

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

I'm having an issue with deploying a WebApp / API to Azure.我在将 WebApp/API 部署到 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.当我在 localhost:44385//api/user/getuser/1 上本地运行它时,它会返回该用户的 JSON,一旦部署到 Azure 上的应用服务,它就会开始返回 404。

Its running on the free version as its for a uni assignment.它在免费版本上运行,作为 uni 任务。 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.希望有人可能有类似的问题。

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.您的 Web API 正确获取了 DB 的连接字符串/它已正确设置和配置。
  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) .如果您的数据出现在正确的位置(您正在查询的数据库和集合/表中 ID = 1 的用户)
  4. If your code is not throwing 404 incorrectly (even in positive scenarios).如果您的代码没有错误地抛出 404(即使在积极的情况下)。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 在.net core mvc 2.1和应用程序中使用MemoryCache将会部署在azure WebApp上 - Use of MemoryCache in .net core mvc 2.1 and application will be deployed on azure WebApp Angular 8 - 路由在本地工作,但在生产环境中部署时,路由不起作用 - .NET 核心 C# 后端 - Angular 8 - routing works locally, but when deployed on Production, routes don't work - .NET Core C# backend ASP.NET Core Web API hosted on Azure don't send an email - ASP.NET Core Web API hosted on Azure don't send an email .Net Core Web API on Azure 不提供 ZDB974238714CA8DE634A7CE1D08 - .Net Core Web API on Azure is not providing API endpoints, only default starter page 如何最好地将 Azure CDN 用于 WebApp 的前端(后端是 .net core Web API) - How to best use Azure CDN for front-end of WebApp (backend is .net core Web API) How do I get .NET redirects to work with an API deployed to an Azure API Management Service with a URL suffix? - How do I get .NET redirects to work with an API deployed to an Azure API Management Service with a URL suffix? 使用 microsoft/azure 登录 Asp.net WebAPP 在 chrome 中不起作用 - Asp.net WebAPP login with microsoft/azure doesn't work in chrome 无法为面向 netcoreapp3.1 的 ASP.NET Core WebApp 中的特定 API 控制器启用 CORS - Can't enable CORS for specific API controllers in ASP.NET Core WebApp targeting netcoreapp3.1 无法为面向 netcoreapp3.0 的 ASP.NET Core WebApp 中的特定 API 控制器启用 CORS - Can't enable CORS for specific API controllers in ASP.NET Core WebApp targeting netcoreapp3.0 不能与.Net Core App中的Azure Blob存储一起使用 - Can't work with Azure Blob Storage from .Net Core App
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM