info: Microsoft.AspNetCore.DataProtection.KeyManagement.XmlKeyManager[0]
User profile is available. Using '/root/.aspnet/DataProtection-Keys' as key repository; keys will not be encrypted at rest.
Hosting environment: Production
Content root path: /root/netcoretest
Now listening on: http://localhost:5000
Now listening on: https://localhost:5001
Application started. Press Ctrl+C to shut down.
这个提示说明 asp.net core 程序已经正常启动
dudu大佬,但是我访问5000这个端口没有反应
就是看不到页面
@QT2019: 是浏览器一直处于等待状态吗?
@dudu:
@dudu: 80端口可以访问,是nginx
@QT2019: Kestrel 绑定的是 http://localhost:5000
,通过公网 IP 无法访问,要改为 UseKestrel(options => options.ListenAnyIP(5000))
public class Program
{
public static void Main(string[] args)
{
CreateWebHostBuilder(args).Build().Run();
}
public static IWebHostBuilder CreateWebHostBuilder(string[] args) =>
WebHost.CreateDefaultBuilder(args)
.UseKestrel(options => options.ListenAnyIP(5000))
.UseStartup<Startup>();
}
@dudu: 要开发端口
用nginx代理一下,将端口5000映射到外网的80端口(或者别的端口)上