问题
I have an ASP .net web application that uses windows authentication. The page displays logged in persons user name (Controller.User.Identity.Name), and has <authentication mode="Windows" />
in web.config. The page works fine in the current server, and my local machine. But when i deployed it to beanstalk server the page doesn't prompt for credentials.
Below are the steps i have done so far. I figured out that i have to enable windows authentication in the EBS IIS server. Added a AWS Elastic Beanstalk configuration file (.ebxtensions) with below command
commands:
01-install-windows-auth:
command: powershell.exe -ExecutionPolicy RemoteSigned "Add-WindowsFeature Web-Security,Web-Windows-Auth"
ignoreErrors: true
waitAfterCompletion: 5
02-enable-iis-windows-auth:
command: powershell.exe -ExecutionPolicy RemoteSigned "Set-WebConfigurationProperty -Filter '/system.webServer/security/authentication/windowsAuthentication' -Name Enabled -Value True -PSPath 'IIS:\' -Location 'Default Web Site'"
ignoreErrors: true
waitAfterCompletion: 5
The Log File from my EB environment:
2017-12-15 10:27:02,152 INFO 1 AWSBeanstalkCfnDeploy.DeploymentUtils - Updating file (Default Web Site/Auth.aspx).
2017-12-15 10:27:02,152 INFO 1 DeploymentLog - Updating file (Default Web Site/Auth.aspx).
2017-12-15 10:27:02,152 INFO 1 AWSBeanstalkCfnDeploy.DeploymentUtils - Updating file (Default Web Site/bin\AuthAWS.dll).
2017-12-15 10:27:02,152 INFO 1 DeploymentLog - Updating file (Default Web Site/bin\AuthAWS.dll).
2017-12-15 10:27:02,152 INFO 1 AWSBeanstalkCfnDeploy.DeploymentUtils - Updating file (Default Web Site/bin\AuthAWS.pdb).
2017-12-15 10:27:02,152 INFO 1 DeploymentLog - Updating file (Default Web Site/bin\AuthAWS.pdb).
2017-12-15 10:27:02,168 INFO 1 AWSBeanstalkCfnDeploy.DeploymentUtils - Updating file (Default Web Site/Web.config).
2017-12-15 10:27:02,168 INFO 1 DeploymentLog - Updating file (Default Web Site/Web.config).
2017-12-15 10:27:02,168 INFO 1 AWSBeanstalkCfnDeploy.DeploymentUtils - Adding ACL's for path (Default Web Site/)
2017-12-15 10:27:02,168 INFO 1 DeploymentLog - Adding ACL's for path (Default Web Site/)
2017-12-15 10:27:02,183 INFO 1 AWSBeanstalkCfnDeploy.DeploymentUtils - Adding ACL's for path (Default Web Site/)
2017-12-15 10:27:02,183 INFO 1 DeploymentLog - Adding ACL's for path (Default Web Site/)
2017-12-15 13:51:00,910 [INFO] Command 01-install-windows-auth succeeded
2017-12-15 13:51:00,910 [INFO] Waiting 5 seconds for reboot
2017-12-15 13:51:06,487 [INFO] Command 02-enable-iis-windows-auth succeeded
2017-12-15 13:51:06,487 [INFO] Waiting 5 seconds for reboot
2017-12-15 13:51:11,519 [INFO] Running configSet Hook-PreAppDeploy
2017-12-15 13:51:11,519 [INFO] Running config Hook-PreAppDeploy
2017-12-15 13:51:13,410 [INFO] Command hooks succeeded
2017-12-15 13:51:13,440 [INFO] Running configSet Infra-EmbeddedPostBuild
2017-12-15 13:51:13,440 [INFO] Running configSet Hook-EnactAppDeploy
2017-12-15 13:51:13,457 [INFO] Running config Hook-EnactAppDeploy
2017-12-15 13:51:17,237 [INFO] Command hooks succeeded
2017-12-15 13:51:17,253 [INFO] Running configSet Hook-PostAppDeploy
2017-12-15 13:51:17,269 [INFO] Running config Hook-PostAppDeploy
2017-12-15 13:51:21,769 [INFO] Command hooks succeeded
2017-12-15 13:51:21,783 [INFO] ConfigSets completed
I guess the authentication was successfully added to the added. I restarted my EBS instance and nothing happened. It still doesnt ask for any authentication on log in.
I have searched on google and it all points to the creation of .ebextensions to configure IIS on the EBS environment. Am i missing something? i just need to enable windows authentication on my application. Any Ideas?
来源:https://stackoverflow.com/questions/47834257/windows-authentication-not-working-in-elastic-beanstalk