Skip to content

Run Locally

After installing BlazorForge, this page explains how to run the site, change the port, and view changes after editing content.

Open a terminal in the BlazorForge folder and run:

Terminal window
dotnet run

Wait until the terminal shows:

Now listening on: http://localhost:5052

Open your browser and go to http://localhost:5052. The site is running.

To stop the site, press Ctrl + C in the terminal.

Every time you run dotnet run, three things happen in order.

First, the Markdown compiler runs. It reads every .md file in wwwroot/content/ and writes JSON metadata files to wwwroot/metadata/. It also generates sitemap.xml, feed.xml, and robots.txt in wwwroot/.

Second, the Blazor project is built. If any code has changed, the compiler rebuilds the affected files.

Third, the development server starts on port 5052.

The first run takes one to three minutes. Subsequent runs take five to ten seconds.

By default, the site runs on port 5052. If that port is already in use, or you want a different port, edit this file:

Properties/launchSettings.json

Open it with any text editor. Find this line:

"applicationUrl": "http://localhost:5052",

Change 5052 to another number, for example 5053:

"applicationUrl": "http://localhost:5053",

Save the file. Stop the site with Ctrl + C, run dotnet run again, and open the new URL.

Every time you edit a Markdown file in wwwroot/content/, you need to recompile the metadata.

Stop the site with Ctrl + C. Then run:

Terminal window
dotnet run

The compiler runs as part of the build, and the new metadata is generated. Refresh the browser to see the changes.

If you are editing CSS or JavaScript, you do not need to restart the server. Just refresh the browser.

If you are editing Razor components or C# code, you need to restart the server.

If you only want to regenerate metadata without running the full site, you can run the compiler directly:

Terminal window
cd Tools
dotnet run
cd ..

This is useful if you want to check the generated JSON, or if you want to commit metadata files to version control before deploying.

By default, dotnet run runs in Development mode. This mode enables detailed error messages, hot reload hints, and other development conveniences.

To run in Production mode, use:

Terminal window
dotnet run --configuration Release

In production mode, the site is optimized for speed. Error messages are less detailed.

For most local development, use Development mode. Use Production mode only for testing the final build.

If something does not work as expected, open the browser’s developer console with F12. Look for errors in the Console tab.

Common issues:

If the page is blank, there may be a JavaScript error. Check the Console tab.

If styles are missing, the CSS file may not have loaded. Check the Network tab.

If content is missing, the metadata JSON may be stale. Stop the site, run dotnet run again, and refresh.

For more detailed debugging in Razor components, use Console.WriteLine statements. Output appears in the browser console.

If the site runs correctly, continue to Deploy to Netlify or Deploy to Cloudflare.

If you want to edit content without code, see Content Editing with Decap CMS.