Problem :
I was trying to get my WCF project with SharePoint 2010 beta product. I had my database on other server. My development server was hosting WCF and SharePoint.
When I run it I started getting following error: Login failed for user <<domain>>\<<server name>>$
Workaround/Solution:
It will need to add user ‘NT AUTHORITY\NETWORK SERVICE’ to your database to get rid of this problem.
An asp.net application is running under NT AUTHORITY\NETWORK SERVICE account.