having trouble enabling both anonymous , windows authentication working when using http.sys webserver in asp.net core 2.0. works fine when host in iis refuses work in http.sys server. method tags [authorize]
on homecontroller windows
action fails http 500 , never prompts authentication.
program.cs
.usehttpsys(options => { options.authentication.schemes = authenticationschemes.negotiate | authenticationschemes.ntlm; options.authentication.allowanonymous = true; options.urlprefixes.add("http://localhost:5000"); })
homecontroller.cs
[authorize] public class homecontroller : controller { [authorize] public iactionresult windows() { return content ("you " + user.identity.name + "; authentication type:" + user.identity.authenticationtype ); } [allowanonymous] public iactionresult anonymous() { return content ("you " + user.identity.name + "; authentication type:" + user.identity.authenticationtype );; } }
exception
an unhandled exception occurred while processing request. invalidoperationexception: no authenticationscheme specified, , there no defaultchallengescheme found. microsoft.aspnetcore.authentication.authenticationservice+<challengeasync>d__11.movenext()
need add following "services" section despite fact it's not hosted in iis
services.addauthentication(microsoft.aspnetcore.server.iisintegration.iisdefaults.authenticationscheme);
Comments
Post a Comment