简体   繁体   English

新部署的 Azure Web 应用程序返回 404 错误代码

[英]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 后在本地工作正常,然后尝试如下配置,

Error page : -错误页面:- 在此处输入图片说明

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.

相关问题 Web 部署在 Azure 上的应用程序未返回 UTC 日期时间 - Web App deployed on Azure not returning datetimes in UTC 在Azure上部署的Web无法访问.less文件(错误代码404)。 本地IIS部署可以正常工作 - Deployed web on Azure cannot access a .less file (error code 404). Local IIS deployment works without error 从一台计算机而不是另一台计算机部署时,C#Web应用程序在Azure中导致404错误 - C# web application causes 404 error in Azure when deployed from one computer, but not from another 部署在Azure Web App / Azure API上时缺少CORS标头 - CORS headers missing when deployed on Azure Web App / Azure API Azure Web 应用程序 c# Z60C05C632A2822A0A877C7E991044 页面无法找到返回页面 - Azure Web App c# razor new page returns 404 page cannot be found Azure function 应用程序在从部署的 web 应用程序调用时未触发 - Azure function app is not triggering while calling from deployed web app Net Core 部署的应用程序在 IIS 上引发错误 404 - Net Core deployed app throws error 404 on IIS 将代码发布到Azure Web App后出现Connect-Msolservice错误 - Connect-Msolservice error after publishing the code to Azure Web App 在 Azure 上部署的 .Net Core 3.1 Web 应用程序显示错误 HTTP 错误 500.35 - ANCM Multiple In-Process Applications in same Process - Deployed .Net Core 3.1 Web app on Azure shows error HTTP Error 500.35 - ANCM Multiple In-Process Applications in same Process 在Azure上部署的.net Web应用程序中存储和执行二进制文件的最佳方法 - best way to store and execute binaries in a .net web app deployed on azure
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM