We have a mixed (forms and Windows)-based SharePoint 2010 site and I'm attempting to use the object model in c# (command line console app, referenced to Microsoft.SharePoint, Solution Platform target is x64 [in VS 2012 I had to create a new solution platform, settings copied from <Empty>].)
In PowerShell, I can simply do something like
$site = Get-SPSite http://www.server.com/sites/site1
It successfully retrieves the object, and I can open the contained SPWebs, etc. as I please. However, when I attempt similar logic in C# (on the same box under the same user credentials) like
using(SPSite site = new SPSite("http://www.server.com/sites/site1") { }
it fails with the FileNotFoundException. Any attempts to use the associated Guids follow the same issue. Why might this be happening?
Also, I am an administrator on the box and also explicitly have sysadmin server role on the database.