【问题标题】:Calling Reporting Services API from SharePoint 2013 application page从 SharePoint 2013 应用程序页面调用 Reporting Services API
【发布时间】:2013-02-01 07:30:55
【问题描述】:

从 SharePoint 2010 升级到 2013 时,我遇到了以下问题。

我有一个应用程序页面,从中进行 SSRS API 调用以获取报告的所有订阅。

ReportingService2010 rs = new ReportingService2010();
rs.Credentials = System.Net.CredentialCache.DefaultCredentials;
rs.Url = serverUrl + "/_vti_bin/ReportServer/ReportService2010.asmx";
try
{
    return rs.ListSubscriptions(reportUrl);
}
catch (SoapException ex)
{ }

在执行此代码期间,我得到一个带有堆栈跟踪的 UnauthorizedAccessException

System.UnauthorizedAccessException: Access is denied. (Exception from HRESULT: 0x80070005 (E_ACCESSDENIED)), StackTrace:    at Microsoft.SharePoint.SPWeb.GetObjectForUrl(String strUrl, Guid& listId)     at Microsoft.ReportingServices.SharePoint.Objects.RSSPImpWeb.GetObject(String strUrl)     at Microsoft.ReportingServices.SharePoint.Server.Utility.GetSPItemMetaDataAndContent(ItemSpecifier itemSpecifier, UserContext userContext, Boolean returnContent, Boolean wrapFileNotFoundOnOpenWeb, Byte[]& content)     at Microsoft.ReportingServices.SharePoint.Server.Utility.GetSharePointItem(ExternalItemPath objectName, UserContext userContext)     at Microsoft.ReportingServices.SharePoint.Server.SharePointDBInterface.GetItemTypeAndId(ExternalItemPath objectName, ItemType& type, Guid& id)     at Micros... 0f35fa9b-1c67-c0b8-f616-d4cac96f7408
...oft.ReportingServices.SharePoint.Server.SharePointDBInterface.ObjectExists(ExternalItemPath objectName, ItemType& type, Guid& id, Int32& snapshotLimit, Byte[]& secDesc, Int32& execOptions, Guid& snapshotId, Guid& linkID)     at Microsoft.ReportingServices.Library.GetItemTypeAction.PerformActionNow()     at Microsoft.ReportingServices.Library.RSSoapAction`1.Execute()     at Microsoft.ReportingServices.Library.ReportingService2010Impl.GetItemType(String itemPath, Boolean fromStore, String parameterName, Boolean allowEditSessionSyntax)     at Microsoft.ReportingServices.Library.ReportingService2010Impl.ListSubscriptions(String ItemPathOrSiteURL, String Owner, SubscriptionImpl[]& SubscriptionItems)     at Microsoft.ReportingServices.ServiceRuntime.ReportServiceManagement.<>c__DisplayClass5b.<L...  0f35fa9b-1c67-c0b8-f616-d4cac96f7408
...istSubscriptions>b__5a()     at Microsoft.ReportingServices.ServiceRuntime.ReportServiceBase.ExecuteWithContext[TResult](Func`1 action)     at Microsoft.ReportingServices.ServiceRuntime.ReportServiceManagement.ListSubscriptions(String ItemPathOrSiteURL)     at SyncInvokeListSubscriptions(Object , Object[] , Object[] )     at System.ServiceModel.Dispatcher.SyncMethodInvoker.Invoke(Object instance, Object[] inputs, Object[]& outputs)     at System.ServiceModel.Dispatcher.DispatchOperationRuntime.InvokeBegin(MessageRpc& rpc)     at System.ServiceModel.Dispatcher.ImmutableDispatchRuntime.ProcessMessage5(MessageRpc& rpc)     at System.ServiceModel.Dispatcher.ImmutableDispatchRuntime.ProcessMessage31(MessageRpc& rpc)     at System.ServiceModel.Dispatcher.MessageRpc.Process(Boolean isOperationCon...  0f35fa9b-1c67-c0b8-f616-d4cac96f7408
...textSet)     at System.ServiceModel.Dispatcher.ChannelHandler.DispatchAndReleasePump(RequestContext request, Boolean cleanThread, OperationContext currentOperationContext)     at System.ServiceModel.Dispatcher.ChannelHandler.HandleRequest(RequestContext request, OperationContext currentOperationContext)     at System.ServiceModel.Dispatcher.ChannelHandler.AsyncMessagePump(IAsyncResult result)     at System.Runtime.Fx.AsyncThunk.UnhandledExceptionFrame(IAsyncResult result)     at System.Runtime.AsyncResult.Complete(Boolean completedSynchronously)     at System.ServiceModel.Channels.SecurityChannelListener`1.ReceiveItemAndVerifySecurityAsyncResult`2.InnerTryReceiveCompletedCallback(IAsyncResult result)     at System.Runtime.Fx.AsyncThunk.UnhandledExceptionFrame(IAsyncResult result)     at Sy...  0f35fa9b-1c67-c0b8-f616-d4cac96f7408
...stem.Runtime.AsyncResult.Complete(Boolean completedSynchronously)     at System.Runtime.InputQueue`1.AsyncQueueReader.Set(Item item)     at System.Runtime.InputQueue`1.EnqueueAndDispatch(Item item, Boolean canDispatchOnThisThread)     at System.Runtime.InputQueue`1.EnqueueAndDispatch(T item, Action dequeuedCallback, Boolean canDispatchOnThisThread)     at System.ServiceModel.Channels.SingletonChannelAcceptor`3.Enqueue(QueueItemType item, Action dequeuedCallback, Boolean canDispatchOnThisThread)     at System.ServiceModel.Channels.HttpPipeline.EnqueueMessageAsyncResult.CompleteParseAndEnqueue(IAsyncResult result)     at System.ServiceModel.Channels.HttpPipeline.EnqueueMessageAsyncResult.HandleParseIncomingMessage(IAsyncResult result)     at System.Runtime.AsyncResult.SyncContinue(IAsyncResu...  0f35fa9b-1c67-c0b8-f616-d4cac96f7408
...lt result)     at System.ServiceModel.Channels.HttpPipeline.EmptyHttpPipeline.BeginProcessInboundRequest(ReplyChannelAcceptor replyChannelAcceptor, Action dequeuedCallback, AsyncCallback callback, Object state)     at System.ServiceModel.Channels.HttpChannelListener`1.HttpContextReceivedAsyncResult`1.ProcessHttpContextAsync()     at System.ServiceModel.Channels.HttpChannelListener`1.BeginHttpContextReceived(HttpRequestContext context, Action acceptorCallback, AsyncCallback callback, Object state)     at System.ServiceModel.Activation.HostedHttpTransportManager.HttpContextReceived(HostedHttpRequestAsyncResult result)     at System.ServiceModel.Activation.HostedHttpRequestAsyncResult.HandleRequest()     at System.ServiceModel.Activation.HostedHttpRequestAsyncResult.BeginRequest()     at Syst...  0f35fa9b-1c67-c0b8-f616-d4cac96f7408
...em.ServiceModel.Activation.HostedHttpRequestAsyncResult.OnBeginRequest(Object state)     at System.ServiceModel.AspNetPartialTrustHelpers.PartialTrustInvoke(ContextCallback callback, Object state)     at System.ServiceModel.Activation.HostedHttpRequestAsyncResult.OnBeginRequestWithFlow(Object state)     at System.Runtime.IOThreadScheduler.ScheduledOverlapped.IOCallback(UInt32 errorCode, UInt32 numBytes, NativeOverlapped* nativeOverlapped)     at System.Runtime.Fx.IOCompletionThunk.UnhandledExceptionFrame(UInt32 error, UInt32 bytesRead, NativeOverlapped* nativeOverlapped)     at System.Threading._IOCompletionCallback.PerformIOCompletionCallback(UInt32 errorCode, UInt32 numBytes, NativeOverlapped* pOVERLAP)   0f35fa9b-1c67-c0b8-f616-d4cac96f7408
Throwing Microsoft.ReportingServices.Diagnostics.Utilities.AccessDeniedException: , Microsoft.ReportingServices.Diagnostics.Utilities.AccessDeniedException: The permissions granted to user 'NT AUTHORITY\ANONYMOUS LOGON' are insufficient for performing this operation.;    0f35fa9b-1c67-c0b8-f616-d4cac96f7408

SP 2010 和 SP 2013 的描述行为相似。在 SharePoint 2010 中,将 ASP.NET 模拟帐户从默认更改为对托管 Web 应用程序具有足够权限的身份将解决该问题。
不幸的是,在 SP 2013 Farm 上这样做会导致另一个 SOAPException 类型的异常

System.Web.Services.Protocols.SoapException: Server was unable to process request. ---> The security token request cannot be completed.    at System.Web.Services.Protocols.SoapHttpClientProtocol.ReadResponse(SoapClientMessage message, WebResponse response, Stream responseStream, Boolean asyncCall)     at System.Web.Services.Protocols.SoapHttpClientProtocol.Invoke(String methodName, Object[] parameters)

我尝试更改匿名身份验证的身份,但遇到了同样的异常。我已经进行了大量调试并阅读了大量日志,但我不知道如何解决这个问题。
任何人都可以提出任何建议吗?

以下是一些可能有帮助的附加信息:
Web 应用程序针对 FBA 进行了配置,并使用 LDAP 提供程序进行身份验证。

谢谢。

【问题讨论】:

  • 看来您需要在 /_vti_bin/authentication.asmx 上调用 Login 方法来获取身份验证 cookie,然后将该 cookie 添加到 rs 连接。看看这个线程social.msdn.microsoft.com/Forums/en-US/…
  • 非常感谢!!!它对我有用。您能否将其添加为答案,以便我接受?

标签: reporting-services sharepoint-2013 reporting-services-2012


【解决方案1】:

由于使用 FBA,设置 rs.Credentials 没有帮助。 FBA 使用身份验证 cookie。在/_vti_bin/authentication.asmx 上调用Login 方法,然后将该cookie 添加到rs 连接。这是类似问题的链接http://social.msdn.microsoft.com/Forums/en-US/sharepointdevelopmentprevious/thread/230de0e1-0d88-4c54-93a4-f166899873be/

【讨论】:

    猜你喜欢
    • 2016-03-14
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2023-03-24
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多