I’m trying to run a portable build of an ASP.NET application on .net 8 on a Raspberry Pi.
I’ve got a Raspberry Pi 4 with the latest lite release of Raspberry Pi oS (Bookworm).
And my publishing settings for the app are:
Delete existing files : false
Configuration : Release
Target Framework : net8.0
Target runtime : Portable
The application starts and outputs this on the Pi:
info: Microsoft.Hosting.Lifetime[14]
Now listening on: http://localhost:5000
info: Microsoft.Hosting.Lifetime[0]
Application started. Press Ctrl+C to shut down.
info: Microsoft.Hosting.Lifetime[0]
Hosting environment: Production
info: Microsoft.Hosting.Lifetime[0]
Content root path: /home/pi/dotnet/lora_api
ApplicationSettings.json:
{
"$schema": "http://json.schemastore.org/launchsettings.json",
"iisSettings": {
"windowsAuthentication": false,
"anonymousAuthentication": true,
"iisExpress": {
"applicationUrl": "http://localhost:21262",
"sslPort": 0
}
},
"profiles": {
"http": {
"commandName": "Project",
"dotnetRunMessages": true,
"launchBrowser": true,
"launchUrl": "swagger",
"applicationUrl": "http://localhost:5020",
"environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "Development"
}
},
"IIS Express": {
"commandName": "IISExpress",
"launchBrowser": true,
"launchUrl": "swagger",
"environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "Development"
}
}
}
}
However, I get no response from localhost:5000 / (RaspiLocalAddress):5000
Am I missing anything?
2
Answers
@Pejda pointed out in their comment that
Environment.IsDevelopment()
is set whenever running under Visual Studio's development server or IIS. The default ASP.NET example for HTTP request API:s have apparently moved both the HTTP request pipeline and the development UI into an if-statment checking if theEnvironment.IsDevelopment()
is set during the app builder. The solution is to move the service for the HTTP request pipeline outside of said if-statement. In my case, only the request service was needed and not the debugging UI that comes alongside so I left the UI inside the condition:It looks like its listening only from localhost? Try to run server with variable: