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.

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.

The breakpoint will not currently be hit. No symbols have been loaded for this document

You will find a lot of different ways to solve this error, but this worked for me.

Working in Visual Studio set a break point.
Hit F5 or Start Debugging.

IE will open.
Start a new InPrivate Browsing IE session (ctrl+Shift+p).
From your first IE session, copy the URL and paste it into your InPrivate session and load the site.

Browse to the item that will trigger your breakpoint.

That’s it.

After doing the above sets, I didn’t see the The breakpoint will not currently be hit. No symbols have been loaded for this document error again.

Using Chrome or Firefox also helped with avoiding this error.

CopyTo in Visual Studio

I’m a little rusty on writing code and this is something that I spent way too much time messing with.

Dim destURL As String = “http://sitename/OtherLibrary/”
workflowProperties.Item.CopyTo(destURL & workflowProperties.Item.Name)

It’s not as simple as saying copy from/to. The CopyTo wants a URL, file name, and file extension.

If you receive this error:

Cannot create an item at the requested destination.  Verify that the folder exists and that you have permission to edit in it.

Start by checking your syntax.