SharePoint error: Web application at xxxx could not be found

Abe Miessler picture Abe Miessler · Jan 24, 2011 · Viewed 52.4k times · Source

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?

Answer

Abe Miessler picture Abe Miessler · Jan 25, 2011

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.