sharepoint2010 SPSite 出错提示“找不到位于 http://xxxx 的 Web 应用程序。请确认正确键入了此 URL。”

sharepoint 07版不会出现这问题是,可10版的出现了,弄了半天不知道错在哪里,上网上了结果搜到答案了,贴出来看看:

这是由于生成的项目的目标平台没有改成X64位所引起的。(原本是X86)

源码:

           SPSite oSite = new SPSite("http://win-02n8aoiofb5/Team/");
            SPWeb oWeb = oSite.OpenWeb();
            SPList oList = oWeb.Lists["TeamTable"];
            for (int i = 1; i <= oList.Items.Count; i++)
            {
                SPListItem oListItem = oList.Items.GetItemById(i);
                this.listBox1.Items.Add(oListItem["名字"].ToString());
            }

原文地址:https://www.cnblogs.com/KimhillZhang/p/2374081.html