gpt4 book ai didi

asp.net - 在 UBUNTU 上托管 ASP.NET CORE 无法通过客户端的浏览器访问

转载 作者:行者123 更新时间:2023-12-04 19:11:39 24 4
gpt4 key购买 nike

我非常需要您的帮助,因为我正在尝试在 ubuntu 服务器上为我的项目创建一个虚拟应用程序,但每次运行已发布的 .dll 文件时,我都无法在我的客户端电脑上访问它。

这是我在我的主机(VM ubuntu 服务器)上所做的

  • 下载dotnet-sdk-2.1
  • dotnet new mvc
  • dotnet publish -c release
  • 将已发布的文件复制到/var/www/firstapp
  • dotnet firstapp.dll给出输出:
    Hosting environment: Production
    Content root path: /home/ubuntu/testapp/netcore/publish
    Now listening on: http://localhost:5000
    Now listening on: https://localhost:5001
    Application started. Press Ctrl+C to shut down.*

    我尝试使用 http://192.168.56.103:5000 在浏览器上访问它(服务器的 ip)但仍然无法访问。

    我尝试打开端口 80、5000、50001 仍然无法连接。我还尝试禁用防火墙。感谢你们。

    最佳答案

    请引用 Why does aspnet core start on port 80 from within Docker?

    您可以使用环境变量来更改监听 ip 和端口,然后运行您的应用程序:

    export ASPNETCORE_URLS=http://+:5000
    dotnet firstapp.dll

    关于asp.net - 在 UBUNTU 上托管 ASP.NET CORE 无法通过客户端的浏览器访问,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/53534327/

    24 4 0
    Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
    广告合作:1813099741@qq.com 6ren.com