• SharePoint问题清单


    目录

    1 显示SharePoint错误... 1

    2 The security validation for this page is invalid. Click Back in your Web browser, refresh the page, and try your operation again. 2

    3 Operation is not valid due to the current state of the object. 2

    4 Illegal characters in path. 【路径中非法字符。】... 4

    5 加载控件模板文件 /_controltemplates/TaxonomyPicker.ascx 失败... 4

    6 SharePoint导航栏错误... 4

    7 解决SharePoint 2010拒绝访问爬网内容源错误的小技巧... 5

    8 部署步骤“回收 IIS 应用程序池”中出现错误: 本地 SharePoint 服务器不可用。请检查该服务器是否正在运行并连接到 SharePoint 服务器场... 6

    9 缺少服务器端相关性... 6

    10 SharePoint 2010 在WebPart页面上调用扩展方法报方法未定义的解决方案... 错误!未定义书签。

    1 显示SharePoint错误

    SharePoint经常会报未知错误,不利于错误的排查,那么你可以做以下操作来处理。

    在该站点下的配置文件里面修改以下节点

    1.<SafeMode MaxControls="200" CallStack="false" DirectFileDependencies="10" TotalFileDependencies="50" AllowPageLevelTrace="false">

    改为:

    <SafeMode MaxControls="200" CallStack="true" DirectFileDependencies="10" TotalFileDependencies="50" AllowPageLevelTrace="false">

    2.<customErrors mode="On " /> 改为:<customErrors mode="Off " />

    3.<compilation batch="false" debug="false ">改为; <compilation batch="false" debug="true ">

    修改后就会把错误源显示出来,总比报"未知错误"好吧!

    2 The security validation for this page is invalid. Click Back in your Web browser, refresh the page, and try your operation again.

    Microsoft.SharePoint.Administration.SPWebApplication webApp = site.Site.WebApplication;

    webApp.FormDigestSettings.Enabled = false;

    SPFile spFile = site.Files.Add(fileUpload.FileName, contents);

    spFile.Item.Update();

    webApp.FormDigestSettings.Enabled = true;

    web.AllowUnsafeUpdates = true;

    site.AllowUnsafeUpdates = true;

    3 Operation is not valid due to the current state of the object

    提升权限

    SPSecurity.RunWithElevatedPrivileges(delegate() {

    SPSite site = new SPSite(http://jianghao:9000 );

    SPWeb web = site.OpenWeb();

    using (site)

    //...

    });

    或者:

    private string GetPictureUrl(string loginName)

        {

    SPSite site = null;

            SPWeb web = null;

            using (site = new SPSite(mySiteUrl))

            {

                using (web = site.RootWeb)

                {

                    web.AllowUnsafeUpdates = true;

                    ServerContext ctx = ServerContext.GetContext(site);

                    UserProfileManager profileMgr = new UserProfileManager(ctx);

                    if (HttpContext.Current != null)

                    {

                        if (HttpContext.Current.Items["HttpHandlerSPWeb"] == null)

                        {

                            HttpContext.Current.Items["HttpHandlerSPWeb"] = web;

                        }

                        if (HttpContext.Current.Items["Microsoft.Office.ServerContext"] == null)

                        {

                            HttpContext.Current.Items["Microsoft.Office.ServerContext"] = ctx;

                        }

                    }

                    if (profileMgr.UserExists(loginName))

                    {

                        //Microsoft.SharePoint.Portal.UserProfiles.UserProfile up =  upMan.GetUserProfile(loginName);

                        Microsoft.Office.Server.UserProfiles.UserProfile up = profileMgr.GetUserProfile(loginName);

                        if (!string.IsNullOrEmpty(up[PropertyConstants.PictureUrl].Value as string))

                        {

                            return up[PropertyConstants.PictureUrl].Value.ToString();

                        }

                        else { return “”; } }

    注意,不能乱提升权限,因为提升权限后一切都是System Account用户的操作!比如是别人回复的博客和 Discussions 的回复人都是"System Account"这个人!这个当然是不对的了!

    4 Illegal characters in path. 【路径中非法字符。】

    检查用户控件src属性值是否换行了。

    5 加载控件模板文件 /_controltemplates/TaxonomyPicker.ascx 失败

    加载控件模板文件 /_controltemplates/TaxonomyPicker.ascx 失败: 未能从程序集“Microsoft.SharePoint.Portal, Version=14.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c”中加载类型“Microsoft.SharePoint.Portal.WebControls.TaxonomyPicker”。

    解决方法:

    用记事本打开  TaxonomyPicker.ascx 文件,定位到第一行 将 字符  "&#44;"  (不包含引号),替换为一个英文逗号 ","

    6 SharePoint导航栏错误

    Microsoft.SharePoint.Publishing.Internal.CodeBehind.AreaNavigationSettingsPage.OKButton_Click(Object sender, EventArgs e)

       at System.Web.UI.WebControls.Button.OnClick(EventArgs e)

       at System.Web.UI.WebControls.Button.RaisePostBackEvent(String eventArgument)

       at System.Web.UI.WebControls.Button.System.Web.UI.IPostBackEventHandler.RaisePostBackEvent(String eventArgument)

       at System.Web.UI.Page.RaisePostBackEvent(IPostBackEventHandler sourceControl, String eventArgument)

       at System.Web.UI.Page.RaisePostBackEvent(NameValueCollection postData)

       at System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) 

    来自 <http://go4answers.webhost4life.com/Example/unable-modify-navigation-headinglink-20585.aspx>

    解决方案一:关闭网站【发布】功能,然后再启用

    解决方案二:从内容数据库“NavNodes”表进行更改,比如:

    INSERT INTO

    [NavNodes] ([SiteId] ,[WebId] ,[Eid] ,[EidParent] ,[NumChildren] ,[RankChild] ,[ElementType] ,[Url] ,[DocId] ,[Name] ,[DateLastModified] ,[NodeMetainfo] , NonNavPage] ,[NavSequence] ,[ChildOfSequence])

    SELECT DISTINCT

    SiteId, WebId ,1002 ,0 ,0 ,1 ,1 ,'' ,NULL ,'SharePoint Top Navbar' ,getdate() ,NULL ,0 ,1 ,0

    FROM NavNodes

    WHERE WebId NOT IN (

      SELECT WebId

    FROM NavNodes

    WHERE Eid = 1002)

    解决方案三:回收应用程序池

    解决方案四:

    This is a very strange behavior. The global navigation seems corrupted. And if I try to modify the navigation through the sharepoint navigation UI, changes won't apply. I have fixed the problem by calling the API.

    My solution: A navigation modification feature.

    In the feature-receiver I have made the code to modify the navigation

    ...

    ' Remove website from global and current navigation

    PublishingWeb pw = PublishingWeb.GetPublishingWeb(mySite);

    pw.IncludeInCurrentNavigation = false;

    pw.IncludeInGlobalNavigation = false;

    This solution is not very nice though. Every time we need a change in the global navigation we have to modify the code and make a redeployment, which seems very troublesome... Any other suggestions on how to solve this problem

    7 解决SharePoint 2010拒绝访问爬网内容源错误的小技巧

    这里有一条解决在SharePoint 2010搜索爬网时遇到的“拒绝访问错误”的小技巧。

    首先要检查默认内容访问帐户是否具有相应的访问权限,或者添加一条相应的爬网规则。如果目标资源库是一个SharePoint库,验证一下该帐号是否具有对该SharePoint web应用程序具有至少“完全读取”的权限。

    当我在升级上来的SharePoint环境中对我新建的博客URL进行爬网时遇到了这个错误。

    这个错误发生在当你运行Windows 2008 R2和SharePoint 2010并且爬网进程试图访问一个本地的sharepoint站点时,会因为“环回请求(LoopbackRequest)”的原因被拒绝。这是在IIS 7和7.5中的一项安全设置。

    解决办法是运行“regedit”,在注册表中“HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Lsa” 下添加一个DWORD值 “DisableLoopBackCheck”=1。

    参考资料

    Access Denied Crawling content source in SharePoint 2010

    8 部署步骤“回收 IIS 应用程序池”中出现错误: 本地 SharePoint 服务器不可用。请检查该服务器是否正在运行并连接到 SharePoint 服务器场

    多用户使用同一测试机进行SharePoint开发时,发现只有Administrator用户可以正确的部署程序集到SharePoint,其他用户即使加到管理员组中也无法部署,VisualStudio2010部署时,提示错误:

    部署步骤“回收 IIS 应用程序池”中出现错误: 本地 SharePoint 服务器不可用。请检查该服务器是否正在运行并连接到 SharePoint 服务器场。

    原因是该用户虽然对SharePoint网站和SharePoint的前端服务器有控制权,但对SharePoint相关数据库没有权限所致,解决方法:

    打开 SahrePoint的SqlServer数据库,服务器----安全性----添加用户

    配置该用户映射:

    为以下数据库添加用户权限为db_owner

    SharePoint_Config

    SharePoint_AdminContent_[guid]

    SharePoint Site Content DB

    再次打开VS,建项目,编译部署,部署成功。

    9 缺少服务器端相关性

    SharePoint 运行状况分析器已检测到一些值得关注的关键问题。

    clip_image002

    直接通过数据库来查找。用来检查错误的timerjob实际上在对应的内容数据库上运行了一个这样的查询:

    SELECT tp_WebPartTypeId, COUNT(1), tp_Assembly, tp_Class
    FROM AllWebParts (NOLOCK)
    WHERE tp_WebPartTypeId IS NOT NULL GROUP BY tp_WebPartTypeId, tp_Assembly, tp_Class

    通过错误信息提供给我们的WebPartTypeId,进行如下的查询:

    SELECT *
    FROM AllWebParts
    WHERE tp_WebPartTypeId = 'b82a8e9d-8706-3252-0a3b-ba19bf65e250'

    该查询可以获取WebSiteID,该表还有一些其他的信息,可供我们排错。常用的几个表以及关系如下:

    SELECT Webs.FullUrl, Webs.Title, AllDocs.DirName, AllDocs.LeafName

    FROM AllDocs, Sites, AllWebParts, Webs

    WHERE Webs.Id = Sites.RootWebId AND AllDocs.Id = AllWebParts.tp_PageUrlID

    AND Sites.Id = AllDocs.SiteId

    找出这些网页,逐个打开并排除这些错误。

    10 SharePoint 2010 在WebPart页面或应用程序页上调用扩展方法报方法未定义的解决方案

    SharePoint 2010前台代码是使用.NET 2.0编译器编译的,故找不到扩展方法,解决该问题的方案是将其设置为3.5编译器,即在web.config添加以下配置:

    <system.codedom> 
      <compilers> 
        <compiler language="c#;cs;csharp" extension=".cs" type="Microsoft.CSharp.CSharpCodeProvider,System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" warningLevel="4"> 
          <providerOption name="CompilerVersion" value="v3.5" /> 
          <providerOption name="WarnAsError" value="false" /> 
        </compiler> 
      </compilers> 
    </system.codedom>

    注意这个:“<providerOption name="CompilerVersion" value="v3.5" />”。

    11 使用Visual Studio 部署SharePoint时提示“路径中具有非法字符”

    在使用VS 2012部署或发布SharePoint时,提示“路径中具有非法字符”(英文提示“Illegal characters in path”),找了半天,才找到答案。

    这个原因是路径中含有中文或者特殊字符导致的。比如使用Windows 8 live帐号登陆,会将中文名作为用户名,这时就会报这个错误。

    解决方案:

    第一,检查临时目录路径,进行修改。

    更改方式如下:用鼠标右键单击“我的电脑” - >属性 - >高级系统设置 - > 环境变量

    clip_image004

    第二,检查项目和解决方案路径:

    VisualStudio2010 - >工具- >选项- >项目和解决方案,确定这些位置不含非法字符(包括中文)。

    clip_image006

    作者:雪雁
    出处:http://www.cnblogs.com/codelove/
    沟通渠道:编程交流群<85318032> 产品交流群<897857351>
    如果喜欢作者的文章,请关注【麦扣聊技术】订阅号以便第一时间获得最新内容。本文版权归作者和湖南心莱信息科技有限公司共有,欢迎转载,但未经作者同意必须保留此段声明,且在文章页面明显位置给出原文连接,否则保留追究法律责任的权利。
    静听鸟语花香,漫赏云卷云舒。
  • 相关阅读:
    中缀表达式转换为后缀表达式
    看4S员工自爆!黑啊,太黑了
    解剖孩子晚上磨牙的6大原因
    2D 3D IMAX 电影座位选择
    蒸鸡蛋羹
    0010 4S店提车注意事项
    2012年北京市车船税基准税额
    火车票预订 电话 和 网站
    远程计算机关机方法
    win7 用户信息丢失
  • 原文地址:https://www.cnblogs.com/codelove/p/3100372.html
Copyright © 2020-2023  润新知