【发布时间】:2018-08-05 20:02:58
【问题描述】:
我正在尝试使用 asp.net core 2.0 应用程序基于 Windows 角色设置基于角色的授权。这是配置:
launchSettings.json:
{
"iisSettings": {
"windowsAuthentication": true,
"anonymousAuthentication": true,
"iisExpress": {
"applicationUrl": "http://localhost:9180/",
"sslPort": 0
}
},
"profiles": {
"IIS Express": {
"commandName": "IISExpress",
"launchBrowser": true,
"environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "Development"
}
},
"Bouwfonds.Gems.Onderhoud.Web.UI": {
"commandName": "Project",
"launchBrowser": true,
"environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "Development"
},
"applicationUrl": "http://localhost:9181/"
}
}
}
StartUp.cs:
public void ConfigureServices(IServiceCollection services) {
services.AddMvc();
services.AddAuthentication(IISDefaults.AuthenticationScheme);
}
在控制器中:
//管理员的 SID 使用:psgetsid.exe 管理员
[Authorize(Roles = @"S-1-5-32-544")]
public class HomeController : Controller
Windows 身份验证正常,但我总是返回 403。有什么想法吗?
【问题讨论】:
标签: windows iis asp.net-core asp.net-authorization