web
You’re offline. This is a read only version of the page.
close
Skip to main content
Community site session details

Community site session details

Session Id :
Service | Customer Service, Contact Center, Fie...
Answered

Execute Multiple Request Error in Azure Function

(0) ShareShare
ReportReport
Posted on by 185

Hi All,

I have receiving an error while using the execute multiple request in the Azure Function:

Error:

An exception occurred in Execute Multiple: System.ServiceModel.ProtocolException: The content type text/html; charset=utf-8 of the response message does not match the content type of the binding (text/xml; charset=utf-8). If using a custom encoder, be sure that the IsContentTypeSupported method is implemented properly.
The Architecture is something as follows: D365 CE <- Flows runs and checks for specific parameters -> Azure Function (it passes the required information as JSON body) -> D365 CE
Azure Function processes the body (Logical operation) and updates the list of records received and pushes the update to D365 CE.
If I used Postman to run the code, the status returned is OK. 
I cannot use single update function since it is bulk update and API limit will be reached. (It also works if single update function is used).
The code used is:
foreach (Entity entity in batch)
{
UpdateRequest updateRequest = new UpdateRequest();
updateRequest.Target = entity;
updateRequests.Add(updateRequest);
}

OrganizationRequestCollection requestCollection = new OrganizationRequestCollection();
requestCollection.AddRange(updateRequests);

ExecuteMultipleRequest execRequest = new ExecuteMultipleRequest()
{
Settings = new ExecuteMultipleSettings()
{
ContinueOnError = true,
ReturnResponses = true
},
Requests = requestCollection
};

try
{
ExecuteMultipleResponse responseWithResults = (ExecuteMultipleResponse)service.Execute(execRequest);
}
catch (Exception ex)
{
throw new Exception("An exception occurred in Execute Multiple: " + ex.ToString());
}
I have the same question (0)
  • Suggested answer
    Pankaj Gogoi Profile Picture
    3,177 on at
    RE: Execute Multiple Request Error in Azure Function

    It could be a data issue. You can debug and check which record is throwing error. Also check the stack trace and inner exception.

    Try sending small batch of data and see if that works.

    Good Luck

    Best Regards

    PG

  • Srinivas Naidu Profile Picture
    185 on at
    RE: Execute Multiple Request Error in Azure Function

    There is no data error, if I debug at the execute multiple request line, it is working fine using postman, status is OK. Only when hosted in Azure, it is throwing the error. That is the reason I am unable to identify and fix it.

  • Pankaj Gogoi Profile Picture
    3,177 on at
    RE: Execute Multiple Request Error in Azure Function

    Can you check the Application Insights if it is logging additional information. it's emitting the response message in html and the application is trying to convert that html to xml, so the underlying issue could be something else.

    Good Luck

    Best Regards

    PG

  • Verified answer
    Srinivas Naidu Profile Picture
    185 on at
    RE: Execute Multiple Request Error in Azure Function

    I was able to resolve this issue doing the below:

    1. The URL that needs to be used while instantiating the IOrgservice must be:  your org url (like: xxxyyy.api.crm.dyamics.comm @"/.../web

    2. Have a null check in the code as necessary including running the execute requests.

  • kokane Profile Picture
    on at
    RE: Execute Multiple Request Error in Azure Function

    It is good to hear you resolve the issue.

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Responsible AI policies

As AI tools become more common, we’re introducing a Responsible AI Use…

Pallavi Phade – Community Spotlight

We are honored to recognize Pallavi Phade as our Community Spotlight honoree for…

Leaderboard > Service | Customer Service, Contact Center, Field Service, Guides

#1
Tom_Gioielli Profile Picture

Tom_Gioielli 42 Super User 2025 Season 2

#2
MVP-Daniyal Khaleel Profile Picture

MVP-Daniyal Khaleel 35

#3
CU29080825-0 Profile Picture

CU29080825-0 16

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans