近日,学习asp.net core ,然后发布了一个简单的web程序,然后部署到centos上面,
[root@debian PublishOutput]# dotnet LinuxTestWeb.dll
Hosting environment: Production
Content root path: /root/PublishOutput
Now listening on: http://localhost:5000
Application started. Press Ctrl+C to shut down.
部署后,提示上面代码,应该是部署成功了吧?然后通过其他机器访问Ip地址:http://172.16.20.151:5000,无法访问
防火墙我也关了。
很纳闷: 配置成功后,默认是5000端口?怎么修改端口呢?请教。。

解决方案 »

  1.   

    telnet端口通么?在服务器上有没5000端口进程?
    在项目根目录中增加一个hosting.json文件,文件内容如下(192.168.57.7是服务器IP):{ "server.urls": "http://192.168.57.7:8080" }
      

  2.   


    通过你的方法,我修改配置了一下hosting.json,项目可以在linux上跑起来了,但是有个问题,asp.net core发布后,都是dll文件,那些css.js 等文件呢,运行时提示缺少文件,An unhandled exception occurred while processing the request.InvalidOperationException: The view 'Index' was not found. The following locations were searched:
    /Views/Home/Index.cshtml
    /Views/Shared/Index.cshtml
      

  3.   

    到项目里确认一下是不是的确有这些视图;
    VS菜单:生成 -> 发布 -> 文件系统,发布到目录以后,把整个目录scp到服务器上。
    css, js在wwwroot下面。