Excel issuing multiple requests to OData service2014-02-20 asp.net excel odata
I've built an OData endpoint using a generic .ashx handler to run some SQL against a SQL Server database and format the payload using ODataLib 5.6. It appears to work as expected and I can view the results in a browser and can import the data into Excel 2013 successfully using the From OData Data Feed option on the Data ribbon.
However, I've noticed that Excel is actually issuing two GET requests when inspecting the HTTP traffic in Fiddler. This is causing some performance concerns since the SQL statement is being issued twice and the XML feed is being sent across the wire twice. The request headers look identical in both requests. The data is not duplicated in Excel. Is there a way to prevent the endpoint from being called multiple times by Excel? I can provide a code snippet or the Fiddler trace if needed.
My suggestion would be to use Power Query for this instead of ADO .Net.
The reason of raising the "duplicated" calls is that ADO .Net is not aware enough to identify the data at the first time. So it gets the schema back first, knowing the details about the data, and it can get and recognize the real data back with the second call. The first call is through the ADO.NET Provider GetSchema call, but that particular provider determines the schema by looking at the data.
- Maximum request length exceeded.
- How do I create an Excel (.XLS and .XLSX) file in C# without installing Microsoft Office?
- OData Feed / Power Query in Excel 2016 Not Retrieving All / Duplicating Some Records
- PowerBI Desktop returning 404 getting OData API but works fine in Fiddler
- Excel/PowerBI OData import gives internal server error 500
- Authenticating Excel Task Pane app to CRM Online
- Give OData service document base URL a trailing slash in WebApi OData