Console Application, SharePoint 2010, accessing SPSite, and FileNotFoundException

When you try to open a site collection using new SPSite("") in e.g. a Console Application you get a FileNotFoundException - "The Web application at http://sharepoint2010/sites/development could not be found. Verify that you have typed the URL correctly. If the URL should be serving existing content, the system administrator may need to add a new request URL mapping to the intended application."

Then the first thing to check is that the Build Platform target is set to x64.

If that doesn't do it for you, thenn hopefully Google will find the anser for you.

No comments: