Host a blazor server app

I have a simple blazor server app on my github repo and I have published the project in the same github repo

Publish Directory - RealEstateWeb/bin/Release/netcoreapp3.1/publish

Deployment is successful but I keep getting following error. It is a blazor server app so it has index.razor page. It does not have any index.html page. And the framework is netcore 3.1

Page Not Found

Looks like you’ve followed a broken link or entered a URL that doesn’t exist on this site.

@nirjhar18 Welcome to the Netlify community.

You cannot run any website that requires a server on Netlify. A server is spun up only during deploy (when needed), and then shut down as the static code is pushed to the global CDN. Netlify is for JAMStack sites; it is not a generic server as you might have with Digital Ocean.

to add on what greg said, there are a number of posts in the forums re: blazor you might find interesting:

I do understand but currently the website that I am trying to deploy does not have any server. It is using the framework/DI of Blazor server but there is no API calls or anything.

Does that mean, I cannot host a static Blazor server website on Netlify?

@nirjhar18 You can host a static site on Netlify. You cannot host any website that requires an active server.

Thank you @gregraven for answering this. I am having some issues like I mentioned, I keep getting an error that page not found. I am hosting a blazor app and there is no active server for that.

Who can help me figure out the issue? Is there a support team or if anyone has hosted a blazor 3.1 app on Netlify before?

Also, I just made the repo public so you can help me. I really appreciate it.

@nirjhar18 I’ll check out your repository, but in the meantime, do any of these posts help you?

@nirjhar18 OK, I checked your repository. I’m not seeing static site files. The path you have as your publish directory contains among other things a bunch of DLL files.

From what I can tell, either you need some kind of build command so that Netlify can make sense of what you’re trying to do, or you need to build the static files somewhere else and then transfer them to Netlify for hosting.

@gregraven Thank you, but is there a specific tutorial that I can follow or someone from support team that can make it work

Hi, @nirjhar18. Did you read the support guide above?

If your site can be built as static files then those files can be deployed at Netlify. Our support team can answer questions about Netlify but I don’t know if any of us have experience with Blazor.

We will need you to show us where the static files you want to deploy are. Can you show us how you generate those files locally and where those files would be found in your directory tree?

Hey @nirjhar18 :wave:t2:

Typically when folks talk about building a “Blazor” app, they’re talking about a streamed-interactivity app where there’s an active, running server (running your .NET back end) and a connected front end that streams content and interactions between the two. It’s a …complicated setup.

You can also create a client-side-only Blazor app. I haven’t done it myself (been out of the .NET game a couple years), but from what I understand, this would allow you to export / publish a static site from your project that uses Blazor’s conversion to WebAssembly to produce a fully static site. Theoretically, this would work on Netlify.

Since Netlify supports Homebrew in the build image, you could theoretically get your build to run your Dotnet build then have Netlify publish the correct output directory… but I saw this all without ever having tested that personally.

This tutorial may help you get started with building a client-site-only Blazor app (e.g. static site). You’d just need to add a netlify.toml file to your repository and correctly configure the build and publish fields. Oh, and a brewfile per the announcement above.

I hope that helps