首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >什么是Microsoft.AspNetCore.DataProtection.KeyManagement.XmlKeyManager核心日志消息: ASP.NET

什么是Microsoft.AspNetCore.DataProtection.KeyManagement.XmlKeyManager核心日志消息: ASP.NET
EN

Stack Overflow用户
提问于 2018-09-20 11:54:30
回答 1查看 9.2K关注 0票数 16

我在每个应用程序启动时都有这个。

有人知道这是从哪里来的吗?

信息: Microsoft.AspNetCore.DataProtection.KeyManagement.XmlKeyManager用户配置文件是可用的。使用‘/Users/thomas/..aspnet/DataProtection’作为密钥存储库;密钥在rest时不会被加密。

代码语言:javascript
复制
// run the web host
var PathToContentRoot = Directory.GetCurrentDirectory();
var Host = WebHost.CreateDefaultBuilder()
    .UseKestrel()
    .UseContentRoot(PathToContentRoot)
    .UseStartup<WebStartup>()
    .UseNLog()
    .Build();

我没有任何关于‘数据保护’,‘密钥’等,我也不想要任何形式的安全功能。

ConfigureServices部分中的代码是:

代码语言:javascript
复制
        // find all controllers
        var Controllers =
            from a in AppDomain.CurrentDomain.GetAssemblies().AsParallel()
            from t in a.GetTypes()
            let attributes = t.GetCustomAttributes(typeof(ControllerAttribute), true)
            where attributes?.Length > 0
            select new { Type = t };

        var ControllersList = Controllers.ToList();
        Logging.Info($"Found {ControllersList.Count} controllers");

        // register them
        foreach (var Controller in ControllersList)
        {
            Logging.Info($"[Controller] Registering {Controller.Type.Name}");
            Services
                .AddMvc()
                .AddJsonOptions(Options => Options.SerializerSettings.ContractResolver = new DefaultContractResolver())
                .AddApplicationPart(Controller.Type.Assembly);
        }

        // add signalR
        Services.AddSignalR();

这样做是为了允许使用来自外部程序集的控制器。

EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2021-02-12 04:41:42

根据您使用的ASP.NET特性,可以设置核心数据保护中间件并将其添加到依赖注入容器中。

这提供了一种存储敏感数据的机制。根据您在此敏感数据中运行的环境将存储在不同的位置。在您的示例中,您将得到这样的消息:它存储在用户配置文件(系统中的一个文件夹)和纯文本中(我假设是因为您在Linux上运行,因为它们在Windows上默认情况下会被加密)。这个文章很好地描述了存储敏感数据的默认位置。

在您的情况下,我怀疑是SignalR的使用导致了核心数据保护中间件的添加。添加它的另一个常见原因是调用

代码语言:javascript
复制
IServiceCollection.AddAuthentication
票数 3
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/52424618

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档