更新时间:2023-02-25 21:28:09
launchSettings.json
仅使用文件通过VS.当您发布应用程序(或在没有VS的情况下运行)时,未使用launchSettings.json
。使用IIS / IISExpress运行时,只需确保web.config具有正确的设置。在您的情况下,web.config中的 forwardWindowsAuthToken
属性丢失或设置为 false
。必须将其设置为 true
才能使Windows身份验证生效。发布前的示例web.config如下所示:
launchSettings.json
file is only used by VS. When you publish your app (or run without VS) launchSettings.json
is not being used. When you run with IIS/IISExpress you just need to make sure that your web.config has correct settings. In your case the forwardWindowsAuthToken
attribute in the web.config is missing or is set to false
. It must be set to true
for Windows Authentication to work. A sample web.config before publishing would look like this:
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<system.webServer>
<handlers>
<add name="aspNetCore" path="*" verb="*" modules="AspNetCoreModule" resourceType="Unspecified"/>
</handlers>
<aspNetCore processPath="%LAUNCHER_PATH%" arguments="%LAUNCHER_ARGS%" stdoutLogEnabled="false" stdoutLogFile=".\logs\stdout" forwardWindowsAuthToken="true"/>
</system.webServer>
</configuration>