[英]New deployed Azure web app is returning 404 Error code
I have deployed an ASP.NET Core Web API project using terraform.我已经使用 terraform 部署了一个 ASP.NET Core Web API 项目。 I can see it has been deployed successfully and the web app service is running.
我可以看到它已成功部署并且 Web 应用程序服务正在运行。 When I browse to the link it returns 404. I was wondering if i can get help on identifying why I am getting 404 error code when it has deployed successfully.
当我浏览到该链接时,它返回 404。我想知道是否可以帮助我确定为什么在成功部署后会收到 404 错误代码。 I am using the FREE Azure subscription in case it makes difference.
我正在使用免费的 Azure 订阅以防万一。 Link: https://tigrinyadictionary-api.azurewebsites.net/
链接: https : //tigrinyadictionary-api.azurewebsites.net/
I have tested in my environment and also getting the HTTP 404 error in my ASP.我已经在我的环境中进行了测试,并且在我的 ASP 中也收到了HTTP 404 错误。 NET Core Web API project after deploy to azure which working fine locally, and then trying some configuration as below,
NET Core Web API 项目部署到 azure 后在本地工作正常,然后尝试如下配置,
SOLUTION -1 : In our ASP.解决方案 -1 :在我们的 ASP 中。 net core web API project there was no
web.config
file, You can try to add one config file in VS . net core web API 项目没有
web.config
文件,你可以尝试在 VS 中添加一个配置文件。 Go to root of your project>Add>new item>search for config >web configuration file .转到项目的根目录>添加>新项目>搜索配置>网络配置文件。
And below is the example of code which you can add your own URI and save it in web.config
file .下面是代码示例,您可以添加自己的 URI 并将其保存在
web.config
文件中。
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<location path="." inheritInChildApplications="false">
<system.webServer>
<handlers>
<add name="aspNetCore" path="*" verb="*" modules="AspNetCoreModuleV2" resourceType="Unspecified" />
</handlers>
<aspNetCore processPath="dotnet" arguments=".\yourURI.dll" stdoutLogEnabled="false" stdoutLogFile="\\?\%home%\LogFiles\stdout" hostingModel="InProcess" />
</system.webServer>
</location>
</configuration>
SOLUTION-2 : Make sure that your url in the browser is correct. SOLUTION-2 :确保您在浏览器中的网址正确无误。 In some scenario we need to add.
在某些情况下,我们需要添加。 Then try to run the Web application .
然后尝试运行 Web 应用程序。 & this is working fine for me .
&这对我来说很好用。
azureAPIurl/api/controllername
azureAPIurl/api/控制器名称
For more information please refer this SO Thread : ASP.NET Core Web API runs locally but not on Azure app service & Dev Blogs: 404 response code caused by App Services有关详细信息,请参阅此 SO 线程: ASP.NET Core Web API 在本地运行,但不在 Azure 应用服务和开发博客上运行: 应用服务引起的 404 响应代码
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.