If running an IIS application configured to access the database using Windows Integrated Security, ensure that you have configured the application pool identity to use your windows login user name.
My machine name is knjiT450. I have an IIS application configured to use Windows Integrated Security to access SQL Server as follows:
<add name=”p_funding” connectionString=”Data Source=servername.companyname.corp;Initial Catalog=test_funding;Integrated Security=True” providerName=”System.Data.SqlClient” />
When running the application, an exception is thrown with the following error:
Login failed for user ‘CORP-DOMAIN\KNJIT450$’.
What is with the $ sign? That threw me off. Also, knjiT450 is definitely not my domain username. Instead, this is my machine name under which IIS is running.
It turns out that application is running under default application pool identity, which users the default built-in-account of ApplicationPoolIdentity. It appears as though the username for this account is the corp-domain\machine-name. Changed this to use custom account, setting the username to my full domain username i.e corp-domain\knji and using my Windows password and that did the trick.