IIS application unable to connect to SQL Server using Integrated Security

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.

Example:

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.

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s