Nic*_*ert 10 iis windows-authentication asp.net-core
我的Asp.Net Core mvc Web应用程序需要Windows身份验证.在开发中,在IIS Express上,由于这个设置,一切正常
launchSettings.json
"iisSettings": {
"windowsAuthentication": true,
"anonymousAuthentication": false,
"iisExpress": {
"applicationUrl": "http://localhost:61545/",
"sslPort": 0
}
}
Run Code Online (Sandbox Code Playgroud)
部署到IIS时,我得到一个空白页面.对我的网站的请求获得500错误代码.
我想这个配置添加到Startup.cs,如解释在这里,没有成功.
services.Configure<IISOptions>(options => {
options.ForwardWindowsAuthentication = true;
});
Run Code Online (Sandbox Code Playgroud)
当我直接在IIS中查看身份验证参数时,将激活Windows身份验证.
我找到一些帖子谈论一个名为的包Microsoft.AspNetCore.Server.WebListener,其他人关于实现自定义中间件.我无法想象这个基本功能需要付出那么多努力.我错过了什么吗?
Paw*_*wel 15
launchSettings.json文件仅供VS使用.当您发布应用程序(或没有VS运行)时launchSettings.json,未使用该应用程序.使用IIS/IISExpress运行时,只需确保web.config具有正确的设置.在您的情况下,forwardWindowsAuthTokenweb.config中的属性缺失或设置为false.必须将其设置true为Windows身份验证才能工作.发布前的示例web.config如下所示:
<?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>
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
10549 次 |
| 最近记录: |