cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
MarcoSi77
Frequent Visitor

Error using OData v4 Data Provider (0x80040224 Failed to connect to OData endpoint)

Hello Community,
I followed this link :
https://docs.microsoft.com/en-us/power-apps/maker/data-platform/virtual-entity-walkthrough-using-oda...

for define an origin data for connect to my database SQL using a Odata v4 Web Service.
When i try to connect to data i receive the message :
"{"error":{"code":"0x80040224","message":"Failed to connect to OData endpoint."}}"

 

Notes:
1.in this moment the service Odata use the certificate SSL and it use the standard port 443
2.The error message from the trace log is:
"Exception type: System.ServiceModel.FaultException`1[Microsoft.Xrm.Sdk.OrganizationServiceFault]
Message: Failed to connect to OData endpoint.Detail:
<OrganizationServiceFault xmlns:i="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://schemas.microsoft.com/xrm/2011/Contracts">
<ActivityId>14fe03fa-d467-4ebe-9545-1b90bb57d117</ActivityId>
<ErrorCode>-2147220956</ErrorCode>
<ErrorDetails xmlns:d2p1="http://schemas.datacontract.org/2004/07/System.Collections.Generic" />
<HelpLink>http://go.microsoft.com/fwlink/?LinkID=398563&amp;error=Microsoft.Crm.CrmException%3a80040224&amp;cl...</HelpLink>
<Message>Failed to connect to OData endpoint.</Message>
<Timestamp>2022-09-16T19:39:30.2406663Z</Timestamp>
<ExceptionRetriable>false</ExceptionRetriable>
<ExceptionSource>PluginExecution</ExceptionSource>
<InnerFault i:nil="true" />
<OriginalException>PluginExecution</OriginalException>
<TraceText i:nil="true" />
</OrganizationServiceFault>"

 

Thank advance.

 

1 ACCEPTED SOLUTION

Accepted Solutions
MarcoSi77
Frequent Visitor

I Have solved the problem.

 

After publishing the odata service on standard port 443, we enabled the IIS trace log for the failed request.

 

From the log file we have retrieved the incoming request:
"GET /odata/Method?$top=10&$select=LastName,UserMD,Id,FirstName&$count=true "

 

This request sent by the "Insomnia" client generated the message:
"A potentially dangerous Request.Path value was detected by the client (&)."

 

The problem is solved with this code in the "Webapiconfig" file:
"config.AddODataQueryFilter (new EnableQueryAttribute
{
AllowedQueryOptions = AllowedQueryOptions.All,
Page size = 10,
MaxNodeCount = 20,
}); "
And
"config.Select (). Expand (). Filter (). OrderBy (). MaxTop (null) .Count ();"

View solution in original post

1 REPLY 1
MarcoSi77
Frequent Visitor

I Have solved the problem.

 

After publishing the odata service on standard port 443, we enabled the IIS trace log for the failed request.

 

From the log file we have retrieved the incoming request:
"GET /odata/Method?$top=10&$select=LastName,UserMD,Id,FirstName&$count=true "

 

This request sent by the "Insomnia" client generated the message:
"A potentially dangerous Request.Path value was detected by the client (&)."

 

The problem is solved with this code in the "Webapiconfig" file:
"config.AddODataQueryFilter (new EnableQueryAttribute
{
AllowedQueryOptions = AllowedQueryOptions.All,
Page size = 10,
MaxNodeCount = 20,
}); "
And
"config.Select (). Expand (). Filter (). OrderBy (). MaxTop (null) .Count ();"

Helpful resources

Announcements
Microsoft 365 Conference – December 6-8, 2022

Microsoft 365 Conference – December 6-8, 2022

Join us in Las Vegas to experience community, incredible learning opportunities, and connections that will help grow skills, know-how, and more.

Users online (1,999)