搞开发是不是很奇怪,昨天.net core3.1 webapi项目在linux中还跑的好好的,咋就过了一个周末为什么就报错了呢?这个错还很奇怪请看咱们的supervisor提供的日志信息
这是我将.net core3.1 webapi项目部署在supervisor进程守护工具中的配置
[program:testfreesql] command=dotnet EmsTestFreeSqlMySql.dll --urls="http://*:5000" directory=/var/testfreesql/ environment=ASPNETCORE_ENVIRONMENT=Development user=root stopsignal=INT autostart=true autorestart=true startsecs=1 stderr_logfile=/var/log/EmsTestFreeSqlMySql.err.log stdout_logfile=/var/log/EmsTestFreeSqlMySql.out.log
阿西吧报这个错,蒙蔽状态 错误信息:backoff Exited too quickly (process log may have details) ,可以断定此处定妖孽作祟,好的,那咱就看看supervisor提供的日志信息把
在linux 查看日志命令
vim /var/log/EmsTestFreeSqlMySql.err.log
发现了妖孽
Unhandled exception. System.InvalidOperationException: Could not determine an appropriate location for storing user secrets. Set the DOTNET_USER_SECRETS_FALLBACK_DIR environment variable to a folder where user secrets should be stored.
at Microsoft.Extensions.Configuration.UserSecrets.PathHelper.GetSecretsPathFromSecretsId(String userSecretsId)
at Microsoft.Extensions.Configuration.UserSecretsConfigurationExtensions.AddUserSecrets(IConfigurationBuilder configuration, String userSecretsId, Boolean reloadOnChange)
at Microsoft.Extensions.Configuration.UserSecretsConfigurationExtensions.AddUserSecrets(IConfigurationBuilder configuration, Assembly assembly, Boolean optional, Boolean reloadOnChange)
at Microsoft.Extensions.Configuration.UserSecretsConfigurationExtensions.AddUserSecrets(IConfigurationBuilder configuration, Assembly assembly, Boolean optional)
at Microsoft.Extensions.Hosting.Host.<>c__DisplayClass1_0.<CreateDefaultBuilder>b__1(HostBuilderContext hostingContext, IConfigurationBuilder config)
at Microsoft.Extensions.Hosting.HostBuilder.BuildAppConfiguration()
at Microsoft.Extensions.Hosting.HostBuilder.Build()
at EmsTestFreeSqlMySql.Program.Main(String[] args) in E:\KCSoftwareTest\testFreesqlPro\EmsTestFreeSqlMySql\Program.cs:line 18
这些bug要加粗,是的看的更清楚些,