【问题标题】:How to run an ASP.NET website in Raspberry PI如何在 Raspberry PI 中运行 ASP.NET 网站
【发布时间】:2022-01-13 10:50:59
【问题描述】:

我正在尝试运行我的 ASP.NET 网站(在 Visual Studio c# 中创建)

我按照以下步骤操作:

  1. 我安装了 Raspbian OS 作为树莓派的操作系统
  2. 我启用了 SSH 连接
  3. 我发布了我的网站,以便能够在 Linux 设备上运行
  4. 然后我将发布文件夹复制到我的 Raspberry 上(使用 WinSCP)
  5. 我尝试使用 Powershell 运行网站,但收到以下消息:
    pi@raspberrypi:~ $ /home/pi/web/Modellfabrik
    info: Microsoft.AspNetCore.DataProtection.KeyManagement.XmlKeyManager[62]
          User profile is available. Using '/home/pi/.aspnet/DataProtection-Keys' as key repository; keys will not be encrypted at rest.
    info: Microsoft.Hosting.Lifetime[0]
          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
  1. 当我尝试在浏览器上运行网站时,使用: http://myraspberryipadress:5000 但它不起作用

【问题讨论】:

  • 您使用什么托管网站?红隼?
  • 如果没有更多信息,很难准确判断问题出在哪里,但可以肯定的是,应用程序现在只监听来自本地主机的连接:http://localhost:5000。重新配置应用程序以侦听 0.0.0.0。
  • 你只是在 localhost 上收听。不在任何公共界面上。更新你的 launchsettings.json

标签: c# asp.net linux visual-studio raspberry-pi


【解决方案1】:

您的树莓派上可能没有打开端口 5000。

运行 nmap -sT -p- <192.168.0.X.X> 以查看您的 pi 上打开的可用端口列表。

查看this 之类的文章,了解如何打开该特定端口。

或者 - 甚至 更安全,在 pi 上设置一个反向代理 nginx 服务器。 Link

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2017-09-16
    • 1970-01-01
    • 1970-01-01
    • 2022-01-25
    • 2016-12-16
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多