Page 1 of 1
.asp Net Core Web Api
Posted: 20 Mar 2020, 08:24
by FerreiraMlg
Hi Guys,
I have fully functional Web Api developed on ASP .Net in Visual Studio. I have published and transferred it to the RevPi.
I have been stuck for hours getting .Net Core SDK or the run time working on the RevPi. The RevPi is up to date, and I have all the dependencies installed.
I have downloaded the 3.1.2 SDK and RunTime from the Microsoft Website for the Linux ARM32 Binaries, and their instructions.
https://dotnet.microsoft.com/download/dotnet-core/3.1
Code: Select all
mkdir -p $HOME/dotnet && tar zxf dotnet-sdk-3.1.200-linux-arm.tar.gz -C $HOME/dotnet
export DOTNET_ROOT=$HOME/dotnet
export PATH=$PATH:$HOME/dotnet
I have followed many tutorials online and cannot make it work. I know the RevPi is based on the Raspberry Pi 3. So is there any difference that would stop me to have a Web App or Web API running on it?
Cheers.
Re: .asp Net Core Web Api
Posted: 20 Mar 2020, 17:33
by jgerlach-erminas
Hi FerreiraMlg,
this has worked for us:
Code: Select all
wget https://download.visualstudio.microsoft.com/download/pr/da60c9fc-c329-42d6-afaf-b8ef2bbadcf3/14655b5928319349e78da3327874592a/aspnetcore-runtime-3.1.1-linux-arm.tar.gz
mkdir -p $HOME/dotnet && tar zxf aspnetcore-runtime-3.1.1-linux-arm.tar.gz -C $HOME/dotnet
rm aspnetcore-runtime-3.1.1-linux-arm.tar.gz
sudo ln -s ~/dotnet/dotnet /usr/bin/dotnet
Publish your asp net core web application project and copy the published files to your RevPi. Then run this in the target folder:
Please post your error messages if it is still not working.
Greetings,
Jones
Re: .asp Net Core Web Api
Posted: 20 Mar 2020, 22:32
by FerreiraMlg
Thanks for your reply.
I did get success installing .Net Core and Asp. I don't really know what I was doing wrong as most of the tutorials are exactly the same instructions, exactly those you wrote.
Code: Select all
dotnet --info
.NET Core SDK (reflecting any global.json):
Version: 3.1.200
Commit: c5123d973b
Runtime Environment:
OS Name: raspbian
OS Version: 9
OS Platform: Linux
RID: linux-arm
Base Path: /home/pi/dotnet/sdk/3.1.200/
Host (useful for support):
Version: 3.1.2
Commit: 916b5cba26
.NET Core SDKs installed:
3.1.200 [/home/pi/dotnet/sdk]
.NET Core runtimes installed:
Microsoft.AspNetCore.App 3.1.2 [/home/pi/dotnet/shared/Microsoft.AspNetCore.App]
Microsoft.NETCore.App 3.1.2 [/home/pi/dotnet/shared/Microsoft.NETCore.App]
To install additional .NET Core runtimes or SDKs:
https://aka.ms/dotnet-download
I am having another issue now, that I cannot find anything exactly as, and can be my lack of knowledge on Web Development that is confusing me.
I got the .Net ASP MVC Solution on my Visual Studio on the laptop (Windows). Which publish target option should I use to publish to deploy for the Pi?
I have been selecting Folder. Copy the files into the Raspberry Pi. Giving full read/write rights to the folder.
On the PI command line run "dotnet my.dll". Which returns the following:
Code: Select all
A fatal error was encountered. The library 'libhostpolicy.so' required to execute the application was not found in '/home/pi/Becker/Api/bin/'.
Failed to run as a self-contained app. If this should be a framework-dependent app, add the /home/pi/Becker/Api/bin/BeckerSmartFanApi.runtimeconfig.json file specifying the appropriate framework.
Re: .asp Net Core Web Api
Posted: 26 Mar 2020, 09:44
by jgerlach-erminas
Hi,
try this configuration in your csproj file:
Code: Select all
<PropertyGroup>
<GenerateDocumentationFile>true</GenerateDocumentationFile>
</PropertyGroup>
This should solve your issue, see also
here.
To my knowledge there are no restrictions to the publishing profile, apart from obvious nonsense like setting the target runtime to windows.