Skip to content

Exception has been thrown by the target of an invocation #10728

@an2508374

Description

@an2508374

What type of issue is this?

Question

What SharePoint development model, framework, SDK or API is this about?

SharePoint REST API

Target SharePoint environment

SharePoint Online

What browser(s) / client(s) have you tested

  • 💥 Internet Explorer
  • 💥 Microsoft Edge
  • 💥 Google Chrome
  • 💥 FireFox
  • 💥 Safari
  • mobile (iOS/iPadOS)
  • mobile (Android)
  • not applicable
  • other (enter in the "Additional environment details" area below)

Additional environment details

Request is done using Application Permissions.

Issue description

When executing SharePoint REST API requests to enumerate list items (in our case: getting the last item ID for a list/drive), sometimes we receive the following error:

Request (example):

GET https://<tenant>.sharepoint.com/sites/<site>/_api/web/lists/GetById('<list-guid>')/items?$orderby=Id desc&$select=Id&$top=1

Response:

Status: 500 Internal Server Error
ErrorCode: "-1, System.Configuration.ConfigurationErrorsException"
Error Message: "Exception has been thrown by the target of an invocation. (C:\\inetpub\\wwwroot\\wss\\VirtualDirectories\\80\\web.config line 909)"

Observed in production logs:

  • A few independent examples (different tenants, sites, drives), which are getting affected by this issue, show the same exception type and the same web.config line reference.
  • This error is usually temporary for affected tenants, but everyday we can find a few another tenants which are experiencing this issue.

Another observations:

  • The request is read-only and quite simple ($top=1, orderby Id desc, select Id) — yet the server returns a configuration exception.
  • The error message references a server-side file path:
    C:\inetpub\wwwroot\wss\VirtualDirectories\80\web.config line 909
    which suggests this failure originates inside SharePoint/IIS hosting infrastructure, not from client payload/formatting.
  • Because the failure happens against SharePoint Online tenants, we cannot inspect or fix the referenced web.config (server-owned).
  • The error appears intermittently: the same operation may succeed at other times for the same tenant/list.

Questions:

  • Is this error by design (e.g., a transient infrastructure failure surfaced as 500)?
  • What is the actual root cause behind:
    System.Configuration.ConfigurationErrorsException pointing to web.config line 909?
  • Is there a recommended client-side handling strategy besides retries (e.g., specific headers, correlation IDs, or backoff rules)?

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions