且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

无法从ASP.Net Web应用程序中读取excel文件

更新时间:2022-11-06 13:10:13

您正在尝试与Excel互操作。 Web应用程序不支持此功能,因为Excel不能同时支持多个请求。



读取这个 [ ^ ]找出原因。
You're trying to do Interop with Excel. This is NOT supported in a web application as Excel doesn't really support multiple requests at the same time.

Read this[^] to find out why.


要使代码正常工作,您需要安装Excel并从您的Web代码中启动。这很难开始工作,并且不受微软支持,也无论如何都无法正常工作。您可以尝试使用Open XML SDK来读取Excel文档,或Excel ODBC驱动程序或Aspose等。



http://typecastexception.com/post/2013/09/25/C-Query- Excel-and-CSV-Files-Using-LinqToExcel.aspx [ ^ ]
To get that code working you'll need Excel installed and launchable from your web code. This is hard to get working, and not supported by Microsoft and won't really work anyway. You can try something like the Open XML SDK to read Excel documents, or the Excel ODBC driver, or Aspose etc.

http://typecastexception.com/post/2013/09/25/C-Query-Excel-and-CSV-Files-Using-LinqToExcel.aspx[^]