System.IO.FileNotFoundException: The web application at could not be found

Online, I found a lot of different solutions to the error but none of them would solve my issue. I had written a console app that reads data from a SharePoint library, then processes the data. The process is started using a scheduled task and runs under the context of a service account. The account had contribute permissions on the library and read access to the site.

The solution:
On the SharePoint Config and Content database(s), grant the account SharePoint_Shell_Access.

After doing this, I noticed this message in the app’s call stack:

 executed on connection "Data Source=SPDevDB;Initial Catalog=SP2010_Dev_Config;Integrated Security=True;Enlist=False;Connect Timeout=15", building a SqlDataReader.
[7132]

After seeing the message, it was clear that the app was first trying to connect to the config db, then it would connect to the site/library objects.