0

I'm facing a strange issue.

I have a console application project and added assembly Microsoft.SharePoint from C:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\14\ISAPI\Microsoft.SharePoint.dll

I'm trying to connect with this code and the URL is correct

//here is throw the exception
using (SPSite Site = new SPSite(myurl))
        {
            using (SPWeb Web = Site.OpenWeb())
            {
                Console.WriteLine("Connected");
            }
        }

Error:

The Web application at myurl 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.

Solution: The solution was to change the platform target of the project from x86 to x64

  • what is in myurl variable? – Thomson Jul 11 '14 at 8:25
  • it the root url site: h ttp://myurpsp – user1898765 Jul 11 '14 at 8:33
  • the target platform was in 86 in place of 64 – user1898765 Jul 11 '14 at 9:05
  • @user1898765 You should add your solution as an answer instead of including it in the question. – Phil Greer Jul 11 '14 at 14:53

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.