Ubuntu dotnet核心用户机密错误

Ubuntu dotnet核心用户机密错误,ubuntu,asp.net-core,Ubuntu,Asp.net Core,这是我的错误: Unhandled Exception: System.ArgumentNullException: Value cannot be null. Parameter name: paths at System.IO.Path.Combine(String[] paths) at Microsoft.Extensions.Configuration.UserSecrets.PathHelper.GetSecretsPathFromSecretsId(String use

这是我的错误:

Unhandled Exception: System.ArgumentNullException: Value cannot be null.
Parameter name: paths
   at System.IO.Path.Combine(String[] paths)
   at Microsoft.Extensions.Configuration.UserSecrets.PathHelper.GetSecretsPathFromSecretsId(String userSecretsId)
   at Microsoft.Extensions.Configuration.UserSecrets.PathHelper.GetSecretsPath(IFileProvider provider)
   at Microsoft.Extensions.Configuration.ConfigurationExtensions.AddUserSecrets(IConfigurationBuilder configuration)
   at WebApplication.Startup..ctor(IHostingEnvironment env) in /root/hackerspulse/Startup.cs:line 29
Startup.cs第29行是这样的:

    builder.AddUserSecrets();
来自该文件的更多代码:

        public Startup(IHostingEnvironment env)
        {
            var builder = new ConfigurationBuilder()
                .SetBasePath(env.ContentRootPath)
                .AddJsonFile("appsettings.json", optional: true, reloadOnChange: true)
                .AddJsonFile($"appsettings.{env.EnvironmentName}.json", optional: true);



            //if (env.IsDevelopment())
            //{
                // For more details on using the user secret store see https://go.microsoft.com/fwlink/?LinkID=532709
                builder.AddUserSecrets();
            //}
            builder.AddEnvironmentVariables();

            Configuration = builder.Build();
        }

它在命令行中运行正常,但当我试图从主管处运行它时,我得到以下错误:(请帮助。

机密管理器仅用于开发时间。请不要在生产环境中使用


我学到了一个变通方法:不使用用户机密,而是使用appsettings.json文件……变通方法有点不好,但是工作你在发布的应用程序或从项目中运行时有这个错误吗?@MikhailZhuravlev从项目中运行很好,发布的应用程序带有supervisor命令=/usr/bin/dotnet/var/www/jademgr/jademgr.dll得到errorJust因为它在开发服务器上,这并不一定意味着这是生产使用,它可能是一个QA/测试环境,我在windows机器上本地开发,但我打算在Linux环境中托管,因为管理Linux主机的成本比windows主机低,这正是.NET Core支持跨平台的全部内容我现在的Linux服务器是我的开发服务器