Search code examples
oledbvisual-foxproiis-10mdac

Fix MDAC n IIS10


I have 32bit API wrote in C#.net 7. That API needs access FOX PRO DBF files using OLEDB drive (32bits). (if exist 64 bits drive do that job, please let me know, so I can upgrade)

All work on IISExpress, on VS2022 Environments (dev, stage, and prod).

I did deploy to IIS 10 on my Local PC, The API run. the issue happens when we request data.

I get this:

Curl

curl -X 'GET' \
  'http://localhost:15080/excessiveReturns' \
  -H 'accept: application/json'

Request URL

http://localhost:15080/excessiveReturns

Server response

CodeDetails500UndocumentedError: Internal Server ErrorResponse bodyDownload

{ "type": "https://tools.ietf.org/html/rfc7231#section-6.6.1",

"title": "An error occurred while processing your request.", "status": 500,

"detail": "The data providers require Microsoft Data Access Components (MDAC). Please install Microsoft Data Access Components (MDAC) version 2.6 or later. - Built-in COM has been disabled via a feature switch. See https://aka.ms/dotnet-illink/com for more information."

}

Response headers content-type: application/problem+json date: Sat,30 Sep 2023 00:16:10 GMT server: Microsoft-IIS/10.0 transfer-encoding: chunked x-powered-by: ASP.NET

I did install MDAC 2.8. reboot my pc. But, the issue still persists

Please any advice to fix this issue?

I appreciate in advance.

I did install MDAC 2.8. reboot my pc. But, the issue still persists


Solution

  • I was focus on the first part of the error message: "The data providers require Microsoft Data Access Components (MDAC). Please install Microsoft Data Access Components (MDAC) version 2.6 or later"

    I found the solution when I search with second part the error message : "Built-in COM has been disabled via a feature switch." the I found this link: System.NotSupportedException in TaskScheduler when using PublishTrimmed .NET6.0

    The solution for this issue is BuiltInComInteropSupport in the project file:

    <PropertyGroup>
    ...
         <BuiltInComInteropSupport>true</BuiltInComInteropSupport>
    </PropertyGroup>