.net HttpContext.User.Identity不';不能在释放模式下工作
我想使用HttpContext.User.Identity,它可以在调试中完美地工作,但发布时它不能识别Windows用户 这是.net HttpContext.User.Identity不';不能在释放模式下工作,.net,asp.net-core,asp.net-identity,.net,Asp.net Core,Asp.net Identity,我想使用HttpContext.User.Identity,它可以在调试中完美地工作,但发布时它不能识别Windows用户 这是launchsetting.json文件 { "iisSettings": { "windowsAuthentication": true, "anonymousAuthentication": false, "iisExpress": { "
launchsetting.json
文件
{ "iisSettings": {
"windowsAuthentication": true,
"anonymousAuthentication": false,
"iisExpress": {
"applicationUrl": "http://localhost:53960/",
"sslPort": 0
} }, "profiles": {
"IIS Express": {
"commandName": "IISExpress",
"launchBrowser": true,
"environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "Development"
}
},
"DataManager": {
"commandName": "Project",
"launchBrowser": true,
"environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "Development"
},
"applicationUrl": "http://localhost:53961/"
} } }
{
"ConnectionStrings": {
"GlossaryConnection": "██████████████",
"EmployeeConnection": "██████████████"
},
"Logging": {
"IncludeScopes": false,
"LogLevel": {
"Default": "Warning"
}
}
}
我目前正在使用.NETCore2.0
Upd:这是我的appsettings.json
文件
{ "iisSettings": {
"windowsAuthentication": true,
"anonymousAuthentication": false,
"iisExpress": {
"applicationUrl": "http://localhost:53960/",
"sslPort": 0
} }, "profiles": {
"IIS Express": {
"commandName": "IISExpress",
"launchBrowser": true,
"environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "Development"
}
},
"DataManager": {
"commandName": "Project",
"launchBrowser": true,
"environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "Development"
},
"applicationUrl": "http://localhost:53961/"
} } }
{
"ConnectionStrings": {
"GlossaryConnection": "██████████████",
"EmployeeConnection": "██████████████"
},
"Logging": {
"IncludeScopes": false,
"LogLevel": {
"Default": "Warning"
}
}
}
多亏了
@Zhi Lv
我所需要的只是检查IIS身份验证配置(打开IIS,选择网站,双击身份验证,然后检查身份验证配置),确保Windows身份验证已启用,匿名身份验证已禁用状态“ASPNETCORE\u环境”:“生产”?不,它不起作用。您是否在发布模式下通过Visual Studio运行应用程序?因为,lauchSettings.json并不是真的要支持。。。另一方面,appSettings.json用于支持在VS.Upd之外运行应用程序:add appSettings.json在哪里部署应用程序?IIS?如果应用程序主机位于IIS上,请检查IIS身份验证配置(打开IIS,选择网站,双击身份验证,然后检查),确保Windows身份验证处于启用状态,匿名身份验证处于禁用状态。