Here is an error I encountered while calling the SPSite object using the URL:
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.
It was the first time I encountered this and this is how I moved about resolving the issue
1. Checked if the URL was really not available.
That wasn't the case. The URL was very much valid and hence this option got eliminated.
2. Google search on this issue almost always pointed to the bit-ness of the platform. That the application was targeting x86 platform and SharePoint Server was x64 bit platform.
In my case, this wasn't true either. Both my platforms were on x86. It was easy to eliminate this option.
3. AAM, Alternate Access Mapping not done properly.
Wasn't an issue in my case. Any guesses? This option was eliminated as well.
4. The code is a windows or web service application which you are running with an account that does not have permissions to connect to SharePoint or SQL Server.
This is where I was at and out of it. This was the issue in my case. My web service code was running on the DefaultAppPool and the identity for the DefaultAppPool was Network Service Account.
I selected configurable and provided the username and password of a user who had elevated privileges.
It all worked and I hope it does for you as well!
Thanks a million, sorted my issue out.
ReplyDeleteThanks a lot. You have described it really well and I was having the same issue.
ReplyDeleteGlad it helped!
Delete