简体   繁体   中英

Unexpected error from external database driver (1) in .NET WebAPI hosted on Azure app services

I have a .NET C# web api application hosted inside Azure App Services. This api reads .xls files from blob storage and stores it inside sql database. I am using following connection string to connect to .xls file.

var connString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" + fpath + ";Extended Properties=\\"Excel 8.0;HDR=YES;IMEX=1;Importmixedtypes=text;typeguessrows=0;\\"";

Last week everything was working properly but now I am getting following error

Unexpected error from external database driver (1)

I also tried to change provider from Microsoft.Jet.OLEDB.4.0 to Microsoft.ACE.OLEDB.12.0 in connection string but I found that it is not supported in Azure App Services. MSDN link

I have not changed any code related to this issue. I think the problem is from Microsoft side, they might have run some security updates.

How should I get it fixed. I need help.

According to this blog , it seems that it is caused by OS update. If you are host in the Azure WebApp, please have a try to connect to Azure support . As the WebApp is the Sandbox , we have no access to change the registry or install the Microsoft.ACE.OLEDB.12.0 for it.

The JET provider is no longer able to connect after the October update. This update (released October 10th, 2017) includes a security update release that inadvertently affects the JET provider. The update was kb4041678 and included in the patch kb4041681

I also create a new Azure WebApp to use Microsoft.Jet.OLEDB.4.0 to read xls file, it also doesn't work on the Azure website.

If other way to read .xls in the Azure WebApp is acceptable, you could use OpenXml SDK . How to use the OpenXml SDK, you could refer to this document .

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM