SetCodeDeploy it on the test machine because oledb is used to operate Excel,ProgramThe following error occurs:
System. invalidoperationexception: the 'Microsoft. Ace. oledb.12.0 'provider is not registered on the local machine.
At system. Data. oledb. oledbserviceswrapper. getdatasource (oledbconnectionstring constr, datasourcewrapper & datasrcwrapper)
At system. Data. oledb. oledbconnectioninternal .. ctor (oledbconnectionstring constr, oledbconnection connection)
At system. Data. oledb. oledbconnectionfactory. createconnection (dbconnectionoptions options, object poolgroupproviderinfo, dbconnectionpool pool, dbconnection owningobject)
At system. Data. providerbase. dbconnectionfactory. createnonpooledconnection (dbconnection owningconnection, dbconnectionpoolgroup poolgroup)
At system. Data. providerbase. dbconnectionfactory. getconnection (dbconnection owningconnection)
At system. Data. providerbase. dbconnectionclosed. openconnection (dbconnection outerconnection, dbconnectionfactory connectionfactory)
At system. Data. oledb. oledbconnection. open ()
At system. Data. Common. dbdataadapter. fillinternal (Dataset dataset, datatable [] datatables, int32 startrecord, int32 maxrecords, string srctable, idbcommand command, commandbehavior behavior)
At system. Data. Common. dbdataadapter. Fill (Dataset dataset, int32 startrecord, int32 maxrecords, string srctable, idbcommand command, commandbehavior behavior)
At system. Data. Common. dbdataadapter. Fill (Dataset dataset)
The connection code is as follows:
Provider = Microsoft. Ace. oledb.12.0; Data Source = {0}; Excel 12.0 XML; HDR = yes;
After the preceding error occurs, install a component. If not, set IIS.
Because Microsoft Office is not installed on the server, a package named accessdatabaseengine.exe is downloaded from the official website.
Instructions:
This download will install a set of components that facilitate the transfer of data between existing Microsoft Office files such as Microsoft Office Access 2007 (*. MDB and *. accdb) files and Microsoft Office Excel 2007 (*. xls ,*. XLSX, and *. xlsb) files to other data sources such as Microsoft SQL Server. connectivity to existing text files is also supported.
After the installation is complete, you also need to configure an attribute in the IIS connection pool:
Open IIS --> Find the application pool corresponding to the website --> advanced settings --> General --> enable the 32-bit application with the value true.