Free hosting for your blazor app


Heroku

Heroku is a cloud platform with full CI/CD support. There you can easily create, deploy, monitor and scall your app. And the most excited thing that it has free option to host your app.

Prerequisites

  • Create blazor app hosted on asp.net core
  • Create repo on github
  • Push your project to github
  • Register on heroku

Creating app on heroku

  • In first step, we have to create app in heroku
  1. Go to your heroku dashboard
  2. Click New -> Create new app
  3. Name and click Create
  4. Connect your app to github repo for enabling deploy
  5. Also you can enable automatic deploy

After these steps you have ability to deploy project manualy, however it will not work yet.

Adding buildpack

Unfoturnately, heroku by default does not support .net apps. So we have to add third party buildpacks for enabling .net apps suport. Don’t worry, it is pretty easy.

  1. You can find Heroku .Net Core Buildpack here
  2. Go to your app on heroku setting tab
  3. In buildpacks section click add buildpack
  4. Copy buildpack github url from github page
  5. Enter coppied url to input and click Save changes

Now heroku knows how to build your app. However, we still are not ready to deploy our app.

Project file

If we would try to deploy our app we got some errors while building. Because buildpack automatically detect project for publishing by looking first Startup.cs file in solution. If we created blazor app hosted on asp.net core , we will have 2 web projects in solution and we must specify PROJECT_FILE in environment variables.

  1. Go to settings page
  2. In Config Vars section click Reveal Config Vars
  3. Add Key PROJECT_FILE with value of relative path to your server csproj file. In my situation, it is PerekupDetector/PerekupDetector.Web/Server/PerekupDetector.Web.Server.csproj
  4. Now you can manually deploy your project in Deploy tab

Conclusion

Heroku gives ability to host your .net core app for free with limited resources. However, it is enough to start up.

Buy Me A Coffee

Related Posts

Avoid reflections of mappers and let Mapster generate mappers for you

Mapster generating tool for onion application

Predict Bitcoin price with ML.net

Live time series coin price predictor with machine learning

Throw exceptions from backend to frontend with blazor

One of advantages of using same code language on both frontend and backend

How to avoid violating of SOLID principles while extending service behaviours

Step by step extending service behaviour with decorator pattern respecting SOLID

Blazor render optimization

Best practices

.Net 6 brings application state to blazor webassembly server prerender

It kills strange blinking on screen

Must have libraries for blazor

List of best nuget packages

Blazor virtualize component

Lazy loading of big lists. Rendering optimization.

Blazor grpc - comunication optimization

Smaller and faster requests to your backend from blazor wasm

Free database for your blazor app

Don't pay for the cloud