I'm getting the following error while trying to create a SPSite instance (not open it, just create it):
"The Web application at <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."
I have SharePoint Foundation 2010 installed on x64 Windows 7 laptop and VS 2008. I've done a lot of searching the last couple of days and I've tried any suggestion there is:
- Setting user permissions to the database.
- Targeting the application for x64 CPU.
- Running my app with the sharepoint app pool account. Creating new app pool.
- Creating windows forms and console applications to run the code from there.
- Adding and removing the web application administrators.
- Checked the logs (nothing in there).
- Writing the URL in full, with machine name and with IP.
The funny thing is that the same code was working fine at one point and then just stopped. I cannot recall to have done anything special to damage it.
Any help will be much appreciated.
Regards, Martin
To answer my own question the sharepoint site had to be on the default port - 80. Publishing it on any other port and trying to access it by putting the port in the URL did not work. Strange but it worked.