'published Blazor server app does not provide css in wwwroot folder on linux
I have a blazor server app that I want to run on a raspberry pi. So far it is all good, I installed it as a service and the service is running like it should. I published the solution to srv/myApp and I have a .service config for it. The only thing missing is the serving of the wwwroot folder. When I open the app all the styles are missing. I have UseStaticFiles() enabled. When I run it locally or just build the project with dotnet run I get the styles from wwwroot. The wwwroot folder does exist in the published folder, though. It somehow just does not make it to my browser. I wanted to avoid running everything in nginx or something as I want to use the self hosting features.
Does anybody see what I am missing here? This is the project, if someone wants to take a look: https://github.com/modmoto/Deploynator
Solution 1:[1]
Ok, i finally found my issue, not all too firm with services on linux. What was missing was the following entry in my service file:
WorkingDirectory=/srv/Deploynator
So my complete .service file looks like this now:
[Unit]
Description=Deploynator service
[Service]
Type=notify
ExecStart=/srv/Deploynator/Deploynator
SyslogIdentifier=Deploynator
WorkingDirectory=/srv/Deploynator
User=pi
Environment=DOTNET_ROOT=/opt/dotnet
Environment="ASPNETCORE_URLS=http://0.0.0.0:5000/"
[Install]
WantedBy=multi-user.target
Hope that this helps someone some day =)
Solution 2:[2]
If you use a program such as Supervisor to drive your service, be sure to set the working directory
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | modmoto |
| Solution 2 | SmRiley |
