Frontend not available when front and back on same Web App Azure

Discussão em 'Angular' iniciado por enmontenegro_elio, Novembro 20, 2024.

  1. I have a project with frontend (Angular) and backend (.net 8). They are both deployed on the root of a Web App in Azure through Azure Devops. The content of the server seems correct. To put in perspective, we migrated backend from .net framework to .net 8. Before it worked but now doesn't seem to work properly on the server, in local it runs ok. I tried this: How to deploy angular app and web API in same azure app service?, but without success. The problem appears when configuring the Web.config.

    If i setup the web.config with accessing only json or font files i can access this files and see the web application with an error as the backend returns a 404 because i haven't configured it on the web.config:

    <configuration>
    <location path="." inheritInChildApplications="false">
    <system.webServer>
    <staticContent>
    <mimeMap fileExtension=".json" mimeType="application/json" />
    <mimeMap fileExtension=".woff" mimeType="application/font-woff" />
    <mimeMap fileExtension=".woff2" mimeType="application/font-woff2" />
    </staticContent>
    </system.webServer>
    </location>
    </configuration>


    Once I add the backend configuration then the the server directly returns a 404 with this message in console: Failed to load resource: the server responded with a status of 404 (). Just like if frontend didn't exist.

    The configuration i add for the backend is

    <handlers>
    <add name="aspNetCore" path="*" verb="*" modules="AspNetCoreModuleV2" resourceType="Unspecified" />
    </handlers>
    <aspNetCore processPath="dotnet" arguments=".\Epea.Api.dll" stdoutLogEnabled="false" stdoutLogFile=".\logs\stdout" hostingModel="inprocess" />


    With this minimum content Swagger is accessible but not frontend. I have tried almost everything, adding rewrite section with rules to Redirect, but the frontend doesn't seem to be accessible as the application always returns a 404.

    The program.cs is normal apart from using app.UseStaticFiles();

    Am i missing something in this file or may it be related with the Web App configuration?

    Continue reading...

Compartilhe esta Página