0

I'm trying to use SP 2010 site from ASP.NET Web Site Project and when I create a new instance of SPSite I get this error: The Web application at 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 know that this question is common over the net but I didnt find the solution for me The Code:

using (SPSite siteCollection = new SPSite("http://sp"))
{
   ;
}

1.I run my code on sharepoint server its the same machine

2.I copy paste the Url to browser and its work

3.I use .NET 3.5 Framework and Visual Studio 2012

4.I have full permission on machine, SharePoint, MS SQL for my account.

Any Suggestion for that big problem

  • Have you tried running your VS2012 instance as an administrator? – NotVonKaiser Jun 3 '13 at 14:29
  • Yes, I've tried running VS2012 instance as an administrator – SDG Jun 4 '13 at 9:20
2

Check the Build Target Platform. It should be "Any CPU", not 32 bit.

This is checked by right click on your project, select "Properties"

Then under Build, resp. Debug, Set Platform to Active(Any CPU)

  • It should work with x64 specifically turned on as well. If the dev has it in x86, the SharePoint dll won't load at all. – NotVonKaiser Jun 3 '13 at 13:52
  • True, will update! – Robert Lindgren Jun 3 '13 at 13:56
  • Thanks, but Build Target Platform is already "Any CPU" – SDG Jun 4 '13 at 9:22
  • Have you tried running the same code from a Console application? Just to rule out any authentication problems related to the fact of the ASP.Net application. – Robert Lindgren Jun 4 '13 at 9:24
  • Yes, I have. I think I understand what the problem is. jeets23.blogspot.ru/2012/07/… "Because this integrated web server of VS 2010 does not run in x64 environment." – SDG Jun 4 '13 at 11:23
1

Ensure that your VS solution targets 64 bit (or Any CPU) platform

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.