I am working now with the MVC5 application over .net framework 4.6.1 and I'm using windows containers. One of the requirements is to create docker image for application. I successfully pulled microsoft/aspnet:4.6.2 image and deployed a web application in the container. In Dockerfile I have added "EXPOSE 1433", to be sure that SQL Server can access host through this port. The problem is with SQL connection. Established connection leads to following error:
System.Data.SqlClient.SqlException (0x80131904): Login failed for user 'NT AUTHORITY\ANONYMOUS LOGON'
I should mention that connection string is with enabled Integration Security. I have tried to set the application pool identity:
Set-ItemProperty IIS:\AppPools\DefaultAppPool\ -Name processModel -Value @{username='domain\user';password='somepassword';identityType=3 }
This, unfortunately, leads to "HTTP Error 503. The service is unavailable", because of the stopped application pool. I have checked the windows event store where I have found three events:
Application pool DefaultAppPool has been disabled. Windows Process Activation Service (WAS) encountered a failure when it started a worker process to serve the application pool.
Application pool DefaultAppPool has been disabled. Windows Process Activation Service (WAS) did not create a worker process to serve the application pool because the application pool identity is invalid.
The identity of application pool DefaultAppPool is invalid. The user name or password that is specified for the identity may be incorrect, or the user may not have batch logon rights. If the identity is not corrected, the application pool will be disabled when the application pool receives its first request. If batch logon rights are causing the problem, the identity in the IIS configuration store must be changed after rights have been granted before Windows Process Activation Service (WAS) can retry the logon. If the identity remains invalid after the first request for the application pool is processed, the application pool will be disabled. The data field contains the error number
I have checked credentials, they are correct. My thoughts are that container has own private domain. That's why I can't connect to SqlServer. Researching I've found this article.
Have anyone tried to configure the Active Directory in docker container? How do you solve the problem with SQL connection?