When developing against the SharePoint object model in an application outside of IIS (service, console, Winforms etc..) you receive the error “FileNotFoundException” when creating an instance of the SPSite object.
System.IO.FileNotFoundException: The Web application at http://
If the URL should be serving existing content, the system administrator may need to add a new request URL mapping to the intended application.\n
at Microsoft.SharePoint.SPSite..ctor(SPFarm farm, Uri requestUri, Boolean contextSite, SPUserToken userToken)\n at Microsoft.SharePoint.SPSite..ctor(String requestUrl)\n
The user running the application needs to have the following permissions and group membership set:
· The user is a server farm administrator.
· The user has Read and Write permissions on the content database.
· The user is a site collection administrator.
· The user has permissions to access the Windows SharePoint Services site or the SharePoint Server 2007 site through which the code iterates.