【发布时间】:2018-04-28 17:27:22
【问题描述】:
尝试在 iis 10 上托管的 asp.net core 2 项目中设置身份验证时,我从 Login.cshtml 得到一个空页面和这个异常(配置 web.config 以写入日志)。
fail: Microsoft.AspNetCore.DataProtection.KeyManagement.KeyRingProvider[48]
An error occurred while reading the key ring.
System.UnauthorizedAccessException: Access to the path 'C:\Windows\system32\config\systemprofile\AppData\Local\ASP.NET\DataProtection-Keys\key-a269af3e-9a68-43f4-95c0-0dbebb957639.xml' is denied.
at System.IO.FileStream.OpenHandle(FileMode mode, FileShare share, FileOptions options)
at System.IO.FileStream..ctor(String path, FileMode mode, FileAccess access, FileShare share, Int32 bufferSize, FileOptions options)
at System.IO.FileStream..ctor(String path, FileMode mode, FileA...
Web.config 写入日志:
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<system.webServer>
<handlers>
<add name="aspNetCore" path="*" verb="*" modules="AspNetCoreModule" resourceType="Unspecified" />
</handlers>
<!--on iis 10-->
<aspNetCore
processPath="dotnet"
arguments=".\GotoLink.Web.dll"
stdoutLogEnabled="true"
stdoutLogFile=".\logs\stdout" />
</system.webServer>
</configuration>
如何使身份验证起作用?
【问题讨论】: