';许可证过期';在ASP.NET中动态生成Excel文档时出错

';许可证过期';在ASP.NET中动态生成Excel文档时出错,asp.net,excel,comexception,Asp.net,Excel,Comexception,有人熟悉下面的错误吗?当我运行我的webapp从我的本地机器生成一个动态excel文档时,它工作正常,但是当在服务器上调用同一段代码时,我得到以下错误。这似乎是一个权限问题,因为它在我的机器上工作,而不是在服务器上,但我不知道从哪里开始,以查明问题。非常感谢您的指导/帮助 Server Error in '/' Application. --------------------------------------------------------------------------------

有人熟悉下面的错误吗?当我运行我的webapp从我的本地机器生成一个动态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版本?如果是这样,我如何确保服务器上有最新版本?

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

服务器上是否有许可的、激活的Excel副本?它可能在您的本地计算机上运行,因为您在本地安装了Office/Excel。

我要说的是,您不能将Office的任何旧副本放在服务器上,让多个用户通过您的网站访问它。您需要了解在服务器环境中使用MS office的许可限制

除了安装之外,您还需要确保在服务器上激活应用程序:

有关于如何执行此操作的详细信息