I have a Console Application
(C#
) that connects to a database
and sends some emails. It runs fine when a user debug in Visual Studio
, but when I copy this to a server and run as a Service Account domain\AcctNotWorking
I get the error below. If I switch the account that runs the Scheduled Task to my domain\login
it works fine. Why is the service account trying to login as NT AUTHORITY\ANONYMOUS LOGON
and any ideas how to fix this? The domain\AcctNotWorking
is an admin on the server and has the appropriate permissions in SQL Server
.
System.Data.Entity.Core.EntityException: The underlying provider failed on Open. ---> System.Data.SqlClient.SqlException: Cannot open database "MyDatabaseName" requested by the login. The login failed. Login failed for user 'NT AUTHORITY\ANONYMOUS LOGON'.
Connection String: add name="ApplicationEntities" connectionString="metadata=res://*/ApplicationEntities" .csdl|res://*/ApplicationEntities" .ssdl|res://*/ApplicationEntities" .msl;provider=System.Data.SqlClient;provider connection string="data source=SQL-Server-Name;initial catalog=DatabaseName;integrated security=True;MultipleActiveResultSets=True;App=EntityFramework"" providerName="System.Data.EntityClient"