Sharepoint Object Model C# Error The Web Application at could not be found. Verify that you have typed the URL correctly
By peter.stilgoe
When running some C# code containing a reference to SPSite ie
string siteUrl = "http://devapp01/";
using (SPSite spSite = new SPSite(siteUrl))
I was getting the following error:
The Web Application at 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.
Looking at various forums people have spent along time troubleshooting this problem, in my case it was easily fixed by:
Go to Project Properties -> Build -> Target Platform -> Make it Any CPU (default is x86)
More From pstilgoe
- Error: Cannot retrieve the information for application credential key
- Deploying K2 process: Error occurred adding the feature to the farm Server was unable to process request. —> Access denied.
- Sharepoint 2010 CQWP: Make the CQWP portable by using tokens to point to the current site instead of static URL
C# , Sharepoint / MOSS / WSS , Sharepoint 2010 , Sharepoint Object Model , Visual Studio 2010 


March 8th, 2011

That saved my day.. Thank you very much
[Reply]
Mine too!
[Reply]
I get the following error both on the when developing on the server and locally “The Web application at http://URL 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”
[Reply]
This worked. Thanks
[Reply]
it is working, thank you
[Reply]
Thanks a lot its working…………..:-)
[Reply]