简体   繁体   English

从.net Web应用程序在Excel中创建数据透视表时出错

[英]Error on creating Pivot Table in Excel from .net web application

In my web application, I am using Microsoft.Office.Interop.Excel to generate a pivot table in Excel. 在我的Web应用程序中,我使用Microsoft.Office.Interop.Excel在Excel中生成数据透视表。 While Executing the application in my Visual studio IDE, the code is working fine and I am getting the Excel file. 在Visual Studio IDE中执行应用程序时,代码可以正常工作,并且我正在获取Excel文件。 But when I hosted the same on IIS, my code is not working and I am receiving the following error 但是当我在IIS上托管相同代码时,我的代码无法正常工作,并且收到以下错误消息

Message: Sys.WebForms.PageRequestManagerParserErrorException: The message received from the server could not be parsed. 消息:Sys.WebForms.PageRequestManagerParserErrorException:无法解析从服务器收到的消息。 Common causes for this error are when the response is modified by calls to Response.Write(), response filters, HttpModules, or server trace is enabled. 导致此错误的常见原因是通过调用Response.Write(),响应过滤器,HttpModules或服务器跟踪来修改响应。 Details: Error parsing near 'Retrieving the COM c'. 详细信息:在“检索COM c”附近解析时出错。

Please guide me to overcome this. 请指导我克服这个问题。

Automation from a service (IIS is a service) poses several problems... but main point is - you should NOT use Office automation server-side as MS says here http://support.microsoft.com/default.aspx?scid=kb;EN-US;q257757#kb2 来自服务的自动化(IIS是一项服务)带来了几个问题...但是要点是-您不应该使用Office自动化服务器端,因为MS在这里说http://support.microsoft.com/default.aspx?scid= kb; EN-US; q257757#kb2

see also here Problems with office automation in asp.net. 另请参阅此处asp.net中的办公自动化问题。 I can use alternatives such as open-office, if I knew how 如果我知道如何使用其他方法,例如开放办公室

If you need to modify/create Excel files there are some libraries out there which work support your scenario (for example Aspose.Cells, Spreadsheetgear, Flexcel etc.) 如果您需要修改/创建Excel文件,则可以使用一些库来支持您的方案(例如Aspose.Cells,Spreadsheetgear,Flexcel等)。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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