I am receiving the following error:
"The Web application at
http://server123:123/
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"
On the following code block:
using (SPSite _site = new SPSite(listUrl))
{
//Code here
}
This error is well documented here
I have ruled out the options as follows:
The option I believe is the problem is "The code is executed on a different machine"
The webpart is deployed on say SharePointFarm1. It uses the search index to build a list of crawled sites that it then uses to pull action items from lists. Some of these are from other Farms.
When the webpart gets to the block of code mentions and attempts to open a site from say SharePointFarm2 (http://sharepointfarm2/thisis/mysite/
I receive the above error.
Am I overlooking another issue or is this a restriction to the SharePoint calls?
You cannot access site from another farm using Server Object Model. To be able to access site using Server Object Model you need to run it locally on server.
Try to use any of the remote endpoints (REST or Client Object Model). You can find full list here.