無法在作為網站安裝的 iis 上使用具有 netcore 應用程式的整合安全性

無法在作為網站安裝的 iis 上使用具有 netcore 應用程式的整合安全性

我在 netcore (2.1.401) 中有一個小測試項目,它透過 CNTLM 傳回登入使用者。我按照[本指南]將其部署到 IIS 伺服器。我還將該網站添加到了主機文件中。

如果我將其部署為預設網站內的應用程序,它可以正常工作。但是,當我嘗試將其作為網站進行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

相關內容