I'm trying to use SP 2010 site from a web application 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:
SPSecurity.RunWithElevatedPrivileges(delegate()
{
using (SPSite site = new SPSite("http://servername:port"))
{
elevatedWeb = site.OpenWeb();
}
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
4.I have full permission on site for administrator account and also dbowner
5.I used platform target Any CPU my sharepoint is 64 and when Im try to make it 64 i face a problrm with my Dll: "Could not load file or assembly or one of its dependencies. An attempt was made to load a program with an incorrect format."
Any Suggestion for that big problem