我在 netcore (2.1.401) 中有一个小型测试项目,它通过 CNTLM 返回已登录的用户。我按照 [本指南] 将其部署到 IIS 服务器。我还将网站添加到 hosts 文件中。
如果我将其作为应用程序部署在默认网站内,它可以正常工作。但是当我尝试将其作为网站部署时,在Anonymous auth
禁用和Windows auth
启用的情况下,我必须多次输入我的凭据,最终收到此错误:
HTTP Error 401.1 - Unauthorized
You do not have permission to view this directory or page using the credentials that you supplied.
Detailed Error Information:
Module WindowsAuthenticationModule
Notification AuthenticateRequest
Handler aspNetCore
Error Code 0xc000006d
Requested URL http://iis.localhost.net:80/user
Physical Path C:\inetpub\wwwroot\iis\user
Logon Method Not yet determined
Logon User Not yet determined
我尝试将自己添加到 web.config 文件中,如下所示:
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<location path="." inheritInChildApplications="false">
<system.webServer>
<handlers>
<add name="aspNetCore" path="*" verb="*" modules="AspNetCoreModule" resourceType="Unspecified" />
</handlers>
<aspNetCore processPath=".\iis.exe" stdoutLogEnabled="false" stdoutLogFile=".\logs\stdout" />
<security>
<authorization>
<allow users="mydomain\myuser" />
<deny users="*" />
</authorization>
</security>
</system.webServer>
</location>
</configuration>
我正在使用 Windows Server 2016 Datacenter,IIS 10.0.14393.0