2013-07-26 52 views
4

在开发服务器上一切正常,但部署后有一个ArgumentException: Value does not fall within the expected range.不幸的是,没有办法直接调试失败的Web部件,所以我只有一些日志信息(例如上面的异常消息和下面显示的代码部分)。 这里是抛出异常代码:SharePoint 2010的值不在预期的范围内

using (SPSite site = new SPSite("http://mysite")) 
{ 
    using (SPWeb web = site.OpenWeb()) 
    { 
     SPList list = web.Lists.TryGetList("MySPList"); 
     foreach (SPListItem item in list.Items) 
     { 
      if (item["Code"].ToString() == code) 
      { 
       if (item["Favorites"] != null) 
       { 
        if (item["Favorites"].ToString().Contains(web.CurrentUser.ID + ";#" + web.CurrentUser.Name)) 
        { 
         // first case simple code 
        } 
        else 
        { 
         // second case simple code 
        } 
       } 
       else 
       { 
        // second case simple code 
       } 
       break; 
      } 
     } 
    } 
} 

回答

6

的问题是在列表视图查询阈值参数:

  • 登录管理中心。
  • 在部分应用程序管理点击管理Web应用程序
  • 选择所需的Web应用程序。
  • 在上面的功能区中点击常规设置并从下拉菜单中选择资源限制
  • 找到列表视图查找阈值并更改它的值(在我的情况下从8到10)。
相关问题