AddMvc Logs DPAPI Error
spiritedsnowcat opened this issue · 4 comments
Summary
When calling AddMvc from IServiceCollection, the following error is logged in the console.
Looking for a workaround to correct it, or redirect logging for ASP.NET Core. Thanks for your time!
Microsoft.AspNetCore.DataProtection.KeyManagement.XmlKeyManager:Information: User profile
is available. Using 'C:\Users\Gareth\AppData\Local\ASP.NET\DataProtection-Keys' as key
repository and Windows DPAPI to encrypt keys at rest.
info: Microsoft.AspNetCore.DataProtection.KeyManagement.XmlKeyManager[0]
User profile is available. Using 'C:\Users\Gareth\AppData\Local\ASP.NET\DataProtection-Keys'
as key repository and Windows DPAPI to encrypt keys at rest.
Version
DotNet 2.0.3
AspNetCore 2.0.1
Startup.cs
public class Startup {
public IConfiguration Configuration { get; }
public Startup(IConfiguration configuration) {
Configuration = configuration;
}
public void ConfigureServices(IServiceCollection services) {
services.AddMvc();
}
}
Project.csproj
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>netcoreapp2.0</TargetFramework>
<PreserveCompilationContext>true</PreserveCompilationContext>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Microsoft.AspNetCore" Version="2.0.1" />
<PackageReference Include="Microsoft.AspNetCore.Hosting" Version="2.0.1" />
<PackageReference Include="Microsoft.AspNetCore.Mvc" Version="2.0.1" />
<PackageReference Include="Microsoft.AspNetCore.Mvc.Razor" Version="2.0.1" />
<PackageReference Include="Microsoft.EntityFrameworkCore.Design" Version="2.0.1" />
<PackageReference Include="Microsoft.EntityFrameworkCore.Sqlite" Version="2.0.1" />
<PackageReference Include="Microsoft.Extensions.DependencyInjection" Version="2.0.0" />
</ItemGroup>
<ItemGroup>
<DotNetCliToolReference Include="Microsoft.EntityFrameworkCore.Tools.DotNet" Version="2.0.1" />
</ItemGroup>
</Project>
That is an info entry, not an error entry. Have you perhaps enabled verbose logging in your application?
Thanks for the quick reply, and I don't believe I am. Here's my appsettings.json file:
{
"Logging": {
"IncludeScopes": false,
"Debug": {
"LogLevel": {
"Default": "Warning"
}
},
"Console": {
"LogLevel": {
"Default": "Warning"
}
}
}
}
and my launch.json file:
{
// Use IntelliSense to find out which attributes exist for C# debugging
// Use hover for the description of the existing attributes
// For further information visit https://github.com/OmniSharp/omnisharp-vscode/blob/master/debugger-launchjson.md
"version": "0.2.0",
"configurations": [
{
"name": ".NET Core Launch (console)",
"type": "coreclr",
"request": "launch",
"preLaunchTask": "build",
"program": "${workspaceFolder}/bin/Debug/netcoreapp2.0/Comet.dll",
"args": [],
"cwd": "${workspaceFolder}/bin/Debug/netcoreapp2.0/",
"console": "internalConsole",
"stopAtEntry": false,
"internalConsoleOptions": "openOnSessionStart",
"env": {
"ASPNETCORE_ENVIRONMENT": "Development"
},
"sourceFileMap": {
"/Views": "${workspaceFolder}/src/Web/Views"
},
"logging": {
"engineLogging": false,
"moduleLoad": false
}
},
{
"name": ".NET Core Attach",
"type": "coreclr",
"request": "attach",
"processId": "${command:pickProcess}"
}
]
}
And how I'm building the service:
static IWebHost BuildWebHost(string[] args) =>
WebHost.CreateDefaultBuilder(args).UseKestrel()
.UseContentRoot(Directory.GetCurrentDirectory())
.UseStartup<Startup>()
.Build();
Is there anything I could add to my launch file's logging section to disable info logging for the DPAPI? Thanks again.
@anurse could you help direct this to the logging owner? I don't recall who the right contact is at the moment. Thanks :)
Figured it out with some reading:
https://docs.microsoft.com/en-us/aspnet/core/fundamentals/logging/?tabs=aspnetcore2x
dotnet add package Microsoft.Extensions.Logging
WebHost.CreateDefaultBuilder(args).UseKestrel()
.UseContentRoot(Directory.GetCurrentDirectory())
.ConfigureLogging(logging => logging.SetMinimumLevel(LogLevel.Warning))
.UseStartup<Startup>()
.Build();
Took a bit of learning, but I get how logging works now. Thanks for the pointers!