如何在IIS服务器中部署时将数据导出到Excel工作表的问题? [英] How to resove the Issue of data exporting to an excel sheet when deployed in IIS server?
问题描述
如何在IIS中部署时恢复导出到Excel工作表的数据问题?
我正在使用带有c#的asp.net。我想将数据从datatable填充到现有的excel模板。它在本地服务器上运行良好,但在IIS中运行不正常。我收到以下错误:
System.UnauthorizedAccessException:由于以下错误,检索CLSID为{00024500-0000-0000-C000-000000000046}的组件的COM类工厂失败:80070005访问被拒绝。 (来自HRESULT的异常:0x80070005(E_ACCESSDENIED))。
How to resove the Issue of data exporting to an excel sheet when deployed in IIS?
I am using asp.net with c#. I want to populate data from datatable to an existing excel template. Its working fine iin local server but not in IIS. I am getting the following error:
System.UnauthorizedAccessException: Retrieving the COM class factory for component with CLSID {00024500-0000-0000-C000-000000000046} failed due to the following error: 80070005 Access is denied. (Exception from HRESULT: 0x80070005 (E_ACCESSDENIED)).
推荐答案
我使用ACE引擎和OleDb写入Excel:通过ADO.NET接口简化数据库访问 [ ^ ]
我避免互操作。
I use the ACE engine with OleDb to write to Excel: Simplified Database Access via ADO.NET Interfaces[^]
I avoid interop.
这篇关于如何在IIS服务器中部署时将数据导出到Excel工作表的问题?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!