Run Locally
After installing BlazorForge, this page explains how to run the site, change the port, and view changes after editing content.
Running the Site
Section titled “Running the Site”Open a terminal in the BlazorForge folder and run:
dotnet runWait until the terminal shows:
Now listening on: http://localhost:5052Open your browser and go to http://localhost:5052. The site is running.
To stop the site, press Ctrl + C in the terminal.
What Happens on Every Run
Section titled “What Happens on Every Run”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.
Changing the Port
Section titled “Changing the Port”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.jsonOpen 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.
Viewing Changes After Editing Content
Section titled “Viewing Changes After Editing Content”Every time you edit a Markdown file in wwwroot/content/, you need to recompile the metadata.
Stop the site with Ctrl + C. Then run:
dotnet runThe 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.
Running the Markdown Compiler Manually
Section titled “Running the Markdown Compiler Manually”If you only want to regenerate metadata without running the full site, you can run the compiler directly:
cd Toolsdotnet runcd ..This is useful if you want to check the generated JSON, or if you want to commit metadata files to version control before deploying.
Development vs Production Mode
Section titled “Development vs Production Mode”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:
dotnet run --configuration ReleaseIn 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.
Debugging
Section titled “Debugging”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.
Next Steps
Section titled “Next Steps”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.