1

In an ASP.NET Core 7 Blazor WebAssembly app, I had everything working well hosting on GitHub Pages via Actions deploying with the help of JamesIves/github-pages-deploy-action@v4

But after upgrading to ASP.NET Core 8 and converting it to a Blazor Web App, it uses a App.razor file in the server project instead of index.html. Index.html is deleted.

I think GitHub Pages needs an index.html to work at all, right? How do I get my Blazor Web App to work in GitHub Pages without index.html? If I just try it the same way as in the Blazor WebAssembly app, I get the 404 page, and I assume that's because I have no index.html. Any suggestions?

1
  • If you already have a Net7 standalone application, then create a net8 Standalone Application and look at what changes between the Net7 and net8 templates. I don't think a lot. The Blazor Web App template is the old Server/WebAssembly hosted template, with pre-rendering in WebAssembly. Commented Mar 10, 2024 at 14:31

1 Answer 1

2

GitHub pages supports static hosting only. A "Blazor WebAssembly Standalone App" can be hosted on GitHUb pages because it is just static files. But a "Blazor Web App", which is what your app is, is incompatible because it needs to run a .Net process to work.

Either convert your app to a "Blazor WebAssembly Standalone App" to be compatible with GitHub pages, try a VPS (Ex. Amazon Lightsail), or maybe try Microsoft Azure. Both have some free offerings or trials.

Sign up to request clarification or add additional context in comments.

2 Comments

Perfect, that makes sense. How can I convert my app to "standalone"? A few searches don't reveal much. Just start over?
Someone already asked how to do that and accepted an answer: Convert a Blazor app created by dotnet new blazor to Blazor WASM 👍

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.