Reputation: 2029
I've got a fairly new Asp Net 6.0 with Angular 13. The website works well with Visual Studio 2022, building and launching. We now want to publish the site to Azure App Service. We notice that after publishing with Visual Studio, or with GitHub Actions, we receive a 404 not found response when browsing to the home page. In order to debug this issue, we tried publishing the site locally and then running it:
dotnet publish -c Release
This command runs the "ng build --prod" command as expected and publishes everything to the bin/Release/net6.0/publish/ folder.
The Angular artifacts are all in the bin/Release/net6.0/publish/wwwroot folder, with an index.html file.
Then i run the dotnet assembly.dll command - the site starts:
However, I then receive the same 404 error. I've tried looking at the Developer Tools in Chrome, but nothing useful was found.
Does anyone have any idea why this is happening? I've tried amending the address in environment.prod.ts. This doesn't appear to help.
I've reproduced this on a mac and Windows machine.
I imagine the error is because some part of the startup can't be found. But how can I resolve please? thanks
I've put together an example of what i mean here: asp.net 6.0 angular. Please see the readme for instructions
Upvotes: 0
Views: 1392
Reputation: 2029
this was a case of the backend url in the index.html being set correctly and also the static files in wwwroot not being served. running dotnet run does not server the static files.
Upvotes: 0