Showing posts with label Console Application. Show all posts
Showing posts with label Console Application. Show all posts

Wednesday, September 14, 2011

Console Application error: The Web Application at could not be found

When we create the Console applications in 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://sharepointsite 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.”
image
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

image

2. Under Project Properties –> Build, Ensure that the platform target is set to x64

image

3. Ensure that the SPSite URL you are trying to open is in your Central Admin –> Web Application alternate access mappings