Unhandled Exception: System.IO.FileNotFoundException: The Web application at http://sp2010:12523 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.
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.
private void button1_Click(object sender, EventArgs e)
{
using (SPSite site = new SPSite("http://sp2010:12523"))
{
using (SPWeb web = site.OpenWeb())
{
SPListCollection lstColl = web.Lists;
}
}
}
Workaround
When you create a new application, it defaults to x86. However sharepoint 2010 is a 64 bit application.
To resolve the issue, View your project properties, go to the Build tab and change the platform target to x64. Run your application again and everything should work as expected now.
{
using (SPSite site = new SPSite("http://sp2010:12523"))
{
using (SPWeb web = site.OpenWeb())
{
SPListCollection lstColl = web.Lists;
}
}
}
Workaround
When you create a new application, it defaults to x86. However sharepoint 2010 is a 64 bit application.
To resolve the issue, View your project properties, go to the Build tab and change the platform target to x64. Run your application again and everything should work as expected now.
No comments:
Post a Comment