ASP.NET动态生成Excel文档时出现“许可证过期”错误

7

有人熟悉下面的错误吗?当我在本地运行我的Web应用程序以从本地生成动态Excel文档时,它可以正常运行,但是当相同的代码在服务器上调用时,就会出现以下错误。似乎这是权限问题,因为它在我的机器上可以工作,但在服务器上却不行,但我不知道从哪里开始才能确定问题。非常感谢您提供的任何指导/帮助!

Server Error in '/' Application.
--------------------------------------------------------------------------------

This command is unavailable because the license to use this application has expired. 
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code. 

Exception Details: System.Runtime.InteropServices.COMException: This command is unavailable because the license to use this application has expired.

Source Error: 

An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.  

Stack Trace: 


[COMException (0x800a03ec): This command is unavailable because the license to use this application has expired.]
   Microsoft.Office.Interop.Excel.Workbooks.Add(Object Template) +0
   PaymentsReport.Page_Load(Object sender, EventArgs e) +70
   System.Web.Util.CalliHelper.EventArgFunctionCaller(IntPtr fp, Object o, Object t, EventArgs e) +15
   System.Web.Util.CalliEventHandlerDelegateProxy.Callback(Object sender, EventArgs e) +34
   System.Web.UI.Control.OnLoad(EventArgs e) +99
   System.Web.UI.Control.LoadRecursive() +47
   System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +1061

在服务器上安装了Office/Excel,我可以在服务器上打开/保存Excel文档。这可能是由于服务器上的Excel版本与我的本地计算机不同导致的。如果是这样,我该如何确保服务器上有最新的Excel版本?

4个回答

5

2

使用Office Interop需要在服务器上安装实际使用的Office组件。


1
我猜你不能随便在服务器上安装任何旧版的Office并让多个用户通过你的网站访问它。你需要查看使用MS Office在服务器环境中的许可限制。

0

您的服务器上是否有已授权、已激活的 Excel 副本?这可能是因为您在本地计算机上安装了 Office/Excel,所以它在本地计算机上可以正常工作。


网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接