A client of mine is used to building applications in Visual Studio 2010 as Console applications or Windows Forms Applications in SharePoint 2007. When they were running the application on their SharePoint 2010 Server, their application kept on getting the following error, when trying to create a new instance of SPSite:
System.IO.FileNotFoundException: “The Web application at http://sharepointserver 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.”
To fix this in SharePoint 2010, there are a few things that should be done:
1. Under Project Properties –> Application, Ensure that the target framework to be compiled against is .NET Framework 3.5
2. Under Project Properties –> Build, Ensure that the platform target is set to x64
3. Ensure that the SPSite URL you are trying to open is in your Central Admin –> Web Application alternate access mappings
No comments:
Post a Comment