SharePoint 2010–SPSite(requestUrl) throws FileNotFoundException

Recently, when I to write a SharePoint Server Object Model code snippet to fetch some list items, I came across this exception at “new SPSite(requestUrl)” method call.  I was just wondering what could be the possible reason and after few minutes of browsing I found out there are multiple reasons that could contribute to this exception, which are as follows:

    - Insufficient privileges to SQL Server
    - Administrator on the Sharepoint Server
    - Part of the WSS_ADMIN_WPG
    - Farm Administrator
    - The Application Pool (for WSS Site and Central Admin) uses the same user

image

After ensuring everything in the above list, still it throws the same exception.  Then, I changed my target platform in project properties to x64, as my DEV machine is 64 bit, then everything worked perfect.  So, if you’ve a 64 bit machine please change your target platform to either x64 or “Any CPU”, which will resolve this issue.