One thing to note is that DOMAIN\MACHINE-NAME$
is the syntax used to represent the machine's credentials on the domain. Similar to how you have a user account, there is also a machine account that is nearly identical (except the permissions are significantly different).
Since you are getting DOMAIN\MACHINE-NAME$
you don't have an impersonation problem. The first thing to do is to look at the application pool to see what identity it is running as.
You can do this by opening IIS Manager and selecting Application Pools. Next select the application pool and click "View Applications" to the right, this allows you to verify everything is setup correctly.
If it is configured correctly then click "Advanced Settings...", under the "Process Model" header there is an "Identity" field, it should be one of the following:
- ApplicationPoolIdentity
- LocalService
- LocalSystem
- NetworkService
- DOMAIN\Account
If it is ApplicationPoolIdentity it is set as you expect, if it is a non-custom one otherwise, you will likely get DOMAIN\MACHINE-NAME$
as you are experiencing. It is doubtful a custom account since that would show up as that account.
If it is ApplicationPoolIdentity and the SQL machine is not on the same machine (or potentially if you use a host name or IP address) you may get DOMAIN\MACHINE-NAME$
since that is the network credentials of ApplicationPoolIdentity. ApplicationPoolIdentity uses IIS AppPool\ApplicationPool
for local access, but DOMAIN\MACHINE-NAME$
for remote access, since the former is only available locally.
Also make sure you are actually using that exact connection string, for the reasons I detailed above about access method being important.
If this doesn't resolve it, it would help if you detailed what Identity you have set, and whether ASP.Net impersonation is enabled.