Ubuntu dotnet user secrets error

Here is my mistake:

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 line 29:

    builder.AddUserSecrets();

More code from this file:

        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();
        }

It works fine from the command line, but when I try to start it from the supervisor, I get this error :( Please help.

+4
source share
1 answer

The secret manager is for development time only. Do not use in a production environment.

https://docs.microsoft.com/en-us/aspnet/core/security/app-secrets

-1
source

Source: https://habr.com/ru/post/1663165/


All Articles