从SP2013中的另一个Web应用程序访问网站协作中的列表时出现“访问被拒绝"异常 [英] 'Access Denied' exception while accessing list in site colletion from another web application in SP2013

查看:50
本文介绍了从SP2013中的另一个Web应用程序访问网站协作中的列表时出现“访问被拒绝"异常的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

你好

我们具有一项功能,可从同一SharePoint 2013服务器中另一个Web应用程序中网站集中存在的列表中访问数据.在访问时,我们得到线程中止".异常,指的是拒绝访问"消息. 但是,我们正在激活功能的Web应用程序的App Pool Identity是目标网站上的网站集管理员,即在创建SPSite对象时在下面的代码中提到.

We have a feature which accesses data from a list present in site collection in another web application in same SharePoint 2013 server. While accessing we are getting "Thread being aborted" exception, which is referring to 'Access denied' message. However App Pool Identity of web application where we are activating feature, is a site collection administrator on destination site i.e. mentioned in below code while creating SPSite object.

在代码中,我们正在访问以下列表.

In code, we are accessing list as below.

SPSecurity.RunWithElevatedPrivileges(委托()
{
 使用(SPSite upgradeSite =新的SPSite(< Site URL>")))
  {
   使用(SPWeb提升的Web =提升的Site.OpenWeb())
       {
          SPList spList =提升的Web.GetList(<列表URL>")); //此处抛出异常线程正在中止"
          //TODO
        } 
  }
});

SPSecurity.RunWithElevatedPrivileges(delegate ()
{
  using (SPSite elevatedSite = new SPSite("<Site URL>"))
  {
   using (SPWeb elevatedWeb = elevatedSite.OpenWeb())
        {
           SPList spList = elevatedWeb.GetList("<List URL>"); //Exception thrown here "Thread being aborted"
           //TODO
         } 
  }
});

此代码在SharePoint 2010环境中可以很好地工作,但是在SharePoint 2013中不能工作.

This code works perfectly fine in SharePoint 2010 environment, however not working in SharePoint 2013.

抛出的异常是:线程正在中止.堆栈跟踪详细信息指向访问被拒绝的异常"

The exception thrown is : "Thread being aborted. In stack trace details are point to 'Access denied exception'

如果有人已经遇到过类似的问题,或者有人可以帮助我们解决问题,这将非常有帮助.

It would be really helpful if someone already faced similar issue or someone can help us in resolving the issue.

谢谢.

关于Sagar的评论Acharya acharya.sagar@hotmail.com

Regards, Sagar Acharya acharya.sagar@hotmail.com

推荐答案

嗨Sagar,

Hi Sagar,

请检查两个Web应用程序AppPool标识是否不同,然后尝试设置为相同的标识.

Please check if the two web application AppPool Identity is different and then try to set to the same identity.

这里有一个类似的线程供您参考:

Here is a similiar thread for your reference:

SPListItem.Update() =>线程正在中止.

SPListItem.Update() => Thread was being aborted.

谢谢

最好的问候


这篇关于从SP2013中的另一个Web应用程序访问网站协作中的列表时出现“访问被拒绝"异常的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆