asp.net-core - 使用主管控制更改 Asp.Net core 3.1 应用程序的 Kestrel 端口号:错误(文件不可执行)
问题描述
解决方案:
在比较旧的(在 VS 更新之前)和新编译的应用程序后发现没有 Pirkimai 可执行文件。在发布目录中
[admin@WEBCORE publish]$ chmod u+x Pirkimai
修改/etc/nginx/conf.d/pirkimai.conf
...
proxy_pass https://localhost:5101;
...
问题:
我有默认端口号为 Asp.Net core 3.1 mvc app 的测试服务器。有用。
现在修改 Program.cs 中的端口
public static IHostBuilder CreateHostBuilder(string[] args) =>
Host.CreateDefaultBuilder(args)
.ConfigureWebHostDefaults(webBuilder => {
webBuilder.UseStartup<Startup>();
**webBuilder.UseUrls("http://localhost:5100", "https://localhost:5101");**
});
并将应用程序复制到 Centos 8 测试服务器
C:\Users\id988\source\repos>scp -r Pirkimai admin@10.161.18.88:
在 linux server cd 发布目录并运行 dotnet
[admin@WEBCORE publish]$ dotnet Pirkimai.dll
info: Microsoft.Hosting.Lifetime[0]
Now listening on: http://localhost:5100
info: Microsoft.Hosting.Lifetime[0]
Now listening on: https://localhost:5101
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/admin/Pirkimai/bin/Release/netcoreapp3.1/publish
Firefox localhost:5100 重定向到https://localhost:5101并像以前一样显示内容。重新启动主管。
[root@WEBCORE supervisord.d]# supervisorctl restart all
Pirkimai: **ERROR (file is not executable)**
现在 Kestrel 不像以前那样启动了。/var/log/supervisor/supervisord.log
...
2020-03-05 09:11:48,976 WARN received SIGTERM indicating exit request
2020-03-05 09:12:08,913 CRIT Supervisor is running as root. Privileges were not dropped because no user is specified in the config file. If you intend to run as root, you can set user=root in the config file to avoid this message.
2020-03-05 09:12:08,915 INFO Included extra file "/etc/supervisord.d/Pirkimai.ini" during parsing
2020-03-05 09:12:08,955 INFO RPC interface 'supervisor' initialized
2020-03-05 09:12:08,955 CRIT Server 'unix_http_server' running without any HTTP authentication checking
2020-03-05 09:12:08,963 INFO daemonizing the supervisord process
2020-03-05 09:12:08,970 INFO supervisord started with pid 974
2020-03-05 09:12:09,985 INFO spawnerr: command at '/home/admin/Pirkimai/bin/Release/netcoreapp3.1/publish/Pirkimai' is not executable
2020-03-05 09:12:10,986 INFO spawnerr: command at '/home/admin/Pirkimai/bin/Release/netcoreapp3.1/publish/Pirkimai' is not executable
2020-03-05 09:12:12,998 INFO spawnerr: command at '/home/admin/Pirkimai/bin/Release/netcoreapp3.1/publish/Pirkimai' is not executable
2020-03-05 09:12:16,016 INFO spawnerr: command at '/home/admin/Pirkimai/bin/Release/netcoreapp3.1/publish/Pirkimai' is not executable
2020-03-05 09:12:16,016 INFO gave up: Pirkimai entered FATAL state, too many start retries too quickly
我的 /etc/supervisord.d/Pirkimai.ini
[program:Pirkimai]
command=/home/admin/Pirkimai/bin/Release/netcoreapp3.1/publish/Pirkimai
directory=/home/admin/Pirkimai/bin/Release/netcoreapp3.1/publish/
environment=HOME="/home/admin",ASPNETCORE__ENVIRONMENT="Production"
user=admin
stopsignal=INT
autostart=true
autorestart=true
startsecs=1
stderr_logfile=/var/log/supervisor/Pirkimai.err.log
stdout_logfile=/var/log/supervisor/Pirkimai.out.log
主管配置中缺少什么?
解决方案
推荐阅读
- python - 如何使用 matplotlib 在同一张图上绘制 2 组 (x,y) 值作为散点图(由线连接)?
- sql - 将最后一个外观添加到表中
- python - 我正在尝试完成一个程序,我会自动从 kithnyc.com 网站购买鞋子
- python - 如何使用 numpy 从 3x3 矩阵中选择 2x2 矩阵?
- python - numpy数组索引:每行的不同列
- javascript - 如何基于普通对象创建嵌套数组
- amazon-web-services - 发生错误:ApiGatewayResourceUsers - 属性 ParentId 的值必须是字符串类型
- performance - 内存使用率高的 dotnet 进程过多
- docker - 是否可以使 docker 的容器输出着色?
- java - 尝试将图像上传到 Firebase 但失败