Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

SharePoint error: Web application at xxxx could not be found

When I try to execute this code:

SPSite siteCollection = new SPSite(@"http://sp-devxxx:10000/");

It throws the following error:

The Web application at http://sp-devxxx:10000 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.

I can hit this site from my web browser, it is compiling in x64, my account has read/write access to the content db, the code is running on the server that the site is running on and there exists an access mapping for this site. Why would it be throwing this error?

like image 676
Abe Miessler Avatar asked Jan 24 '11 21:01

Abe Miessler


2 Answers

OK, after hours of pain i finally found the problem....

I had to add myself to the WSS_ADMIN_WPG group on the server. Hope this helps someone.

like image 50
Abe Miessler Avatar answered Oct 23 '22 08:10

Abe Miessler


Change Target Platform to x64 as Sharepoint 2010 runs only in 64 bit mode

like image 13
prakash Avatar answered Oct 23 '22 10:10

prakash