在创建msproject.application对象时获取系统outofmemory异常 [英] Getting system outofmemory exception while creating msproject.application object
问题描述
我正在用C#编写一个Web应用程序来读写MS Project文件。当我创建Microsoft.Office.Interop.MSProject.Application的实例时,我得到System.OutOfMemory Exception。我从IIS执行网页时遇到此异常。在localhost上,它工作正常。
问候,
UU
我尝试过什么:
我尝试从localhost执行应用程序,它可以工作。它不适用于IIS。
Microsoft Office程序在Windows服务/ IIS中使用是不安全的。只有在具有在用户会话中运行的GUI的程序时,才应使用Microsoft.Office.Interop库。
尝试找到一个可以在不调用MS Project的情况下使用MS Project文件的库。
参见: https://support.microsoft.com/en-us/kb/257757 [ ^ ]
Microsoft目前不建议也不支持从任何无人参与的非交互式客户端应用程序或组件(包括ASP,ASP.NET,DCOM和NT服务)自动化Microsoft Office应用程序,因为Office可能会出现不稳定的行为, /或在此环境中运行Office时死锁。顺便说一句,OutOfMemoryException通常只是非托管组件的错误翻译错误。
[/ Edit]
Hi,
I am writing a web application in C# to read and write into MS Project file. When I create an instance of Microsoft.Office.Interop.MSProject.Application, I get System.OutOfMemory Exception. I get this exception on while executing the web page from IIS. On localhost, it works fine.
Regards,
UU
What I have tried:
I tried executing the application from localhost, it works. It doesn't work over the IIS.
Microsoft office programs are not safe for use in Windows services / IIS. You should use the Microsoft.Office.Interop library only when you have a program with a GUI running in a user session.
Try to find a library which can work with the MS Project files without calling MS Project.
[Edit]
See also: https://support.microsoft.com/en-us/kb/257757[^]
Microsoft does not currently recommend, and does not support, Automation of Microsoft Office applications from any unattended, non-interactive client application or component (including ASP, ASP.NET, DCOM, and NT Services), because Office may exhibit unstable behavior and/or deadlock when Office is run in this environment.By the way, "OutOfMemoryException" is often just an erroneously translated error of a non-managed component.
[/Edit]
这篇关于在创建msproject.application对象时获取系统outofmemory异常的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!