Hello Community,
I followed this link :
https://docs.microsoft.com/en-us/power-apps/maker/data-platform/virtual-entity-walkthrough-using-odata-provider#data-source-details
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&error=Microsoft.Crm.CrmException%3a80040224&client=platform</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.
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 ();"
stampcoin
17
mmbr1606
13
Super User 2025 Season 1
ankit_singhal
11
Super User 2025 Season 1