Quantcast
Channel: ASP.NET Core
Viewing all articles
Browse latest Browse all 9386

Run dnx with sudo on Raspberry Pi 2 to control LCD 16*02 display

$
0
0

Hi,

I have tried to run .net 5 basic web app on raspberry pi 2 with Raspbian. It work fine.

But now i try to control LCD 16*02 display, it got below error:

bcm2835_init: Unable to open /dev/mem: Permission denied

An unhandled exception has occurred: The type initializer for 'RaspberryPi DotNet.GPIOMem' threw an exception.
System.TypeInitializationException: The type initializer for 'RaspberryPiD otNet.GPIOMem' threw an exception. ---> System.Exception: Unable toinitialize b cm2835.so library

It is due to no permission to access /dev/mem,. i have face this error.

Before using .net 5, I use mono with xsp4 web server to run .net 4.X.X to control LCD display

and need run xsp4 as root by cmd: 

 sudo xsp4 

and then work great.

So i try to run as root in this case (.net 5) by cmd : 

sudo dnx web

then got msg: 

sudo: dnx: command not found

After that i search a moment and found that use 

which dnx

to get the path of dnx, and then run below :

sudo /home/pi/.dnx/runtimes/dnx-mono.1.0.0-rc1-update1/bin/dnx web

now i get this error:

Error: Unable to load application or execute command 'Microsoft.AspNet.Server.Kestrel'. Available commands: web, ef.

it seems cannot run dnx as root , as i change to root ac and run:

dnx web

i get the same error :

Error: Unable to load application or execute command 'Microsoft.AspNet.Server.Kestrel'. Available commands: web, ef.

Is it possible to run dnx with root ? or run Kestrel as root? because the web server need root right to access /dev/mem,

Many Thanks ~


Viewing all articles
Browse latest Browse all 9386

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>