I have deployed an ASP.NET Core Web API project using terraform. I can see it has been deployed successfully and the web app service is running. 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. I am using the FREE Azure subscription in case it makes difference. Link: https://tigrinyadictionary-api.azurewebsites.net/
I have tested in my environment and also getting the HTTP 404 error in my ASP. NET Core Web API project after deploy to azure which working fine locally, and then trying some configuration as below,
SOLUTION -1 : In our ASP. net core web API project there was no web.config
file, You can try to add one config file in 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 .
<?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. In some scenario we need to add. Then try to run the Web application . & this is working fine for me .
azureAPIurl/api/controllername
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
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.