Awesome
Blazor Wake-on-LAN
This is a Wake-on-LAN app for your network, written in server-side blazor. I developed it for internal use at my workplace and because I wanted to build a small, limited-scope but fully-working and done-right blazor app. Getting started is as easy as downloading and running. Feel free to improve/fork/PR this if you think I could have done anything better.
Getting Started
With Docker
You can start a BlazorWoL docker container like this:
docker run -e "ConnectionStrings__SqliteConnection=Data Source=/blazorwol/db.sqlite" -v /var/blazorwol:/blazorwol --network host --name blazorwol ghcr.io/georg-jung/blazorwol:latest
Please note that this does not work on Windows, even with WSL, as docker host networking is required.
By downloading binaries
- Download and unzip the latest release.
- Run the application by starting
WoL.exe
- Open the shown location in a browser (probably
localhost:5000
) and add your first host.
You can add the application to IIS for more serious hosting. You can set up T-SQL as a backend for backup etc.. See the appsettings.json
file for details. If you host this in IIS you might want to configure it to be always running, otherwise the first request after some idle time will take seconds.
Download
The platform-specific releases have no prerequisits. Just unpack and double-click. The framework dependend release is smaller and portable but requires .Net 7 Runtime to be installed.
- Windows x86
- This app does not take advantage of 64bit, so I chose to deploy x86 due to the smaller footprint.
- Windows x86 IIS
- All files listed here except from the Runtime Dependent one are self contained. Thus, you don't need to have the .Net runtime installed. They are published as single file executables too (you get one ~85mb exe file instead of hundreds of smaller files). To be able to host a .Net application in IIS it must not be published as a single file. So, if you want to host BlazorWoL in IIS, you may choose this download.
- Windows ARM
- Linux x64
- Runtime Dependent (.Net 7.0) previously known as framework dependent
Features
- Wake arbitrary hosts on the network of the server where this is hosted via Magic Packet
- Add new hosts via the webinterface using either their hostname or their mac address.
- Detect the online status of saved hosts. To determine, they are at the same time pinged and we try to establish a TCP connection on port 3389. This port is used by the Microsoft Remote Desktop Protocol. This way, we can work with hosts that don't answer normal pings.
- Delete existing hosts from the list.
- When waking a host, the application repeatedly tries to reach the host and updates you about the status. You see immediately when the host finished booting so that you can connect via ssh/RDP/etc..
Showcase
This application uses the following techniques and might be suitable as a simple but full-fledged example of how they work:
- Blazor
- Components and Pages in Razor
- UI-Server-interaction which would typically require AJAX/writing JavaScript. See the
Wake
page and the Status column of the index page.
- .Net 7
- Entity Framework Core Code First
- Automatic Migrations
- Supports T-SQL and SQLite, selection by connection string in
appsettings.json
- Dependency Injection using
Microsoft.Extensions.DependencyInjection
- Continuous Integration and Continuous Deployment using GitHub Actions.
- Docker image creation and push
- Zipped executables in GitHub Release
- Dependency updates are partly automated using Dependabot.
- Usage of Microsoft.Extensions.Logging with event ids and custom parameters.
- Usage of Application Insights to keep track of logged application events in production.
- Git height based versioning using NBGV.
Known Limitations
- Adding hosts by hostname is currently impossible on platforms except Windows and Linux, as there is no appropriate ARP API.