因为需要在服务器端将ppt转换成其他格式,所以在iis下调用了编好的python。
在非服务器的环境下是可以正常使用的,但是iis下使用
using System.Diagnostics;
Process p = new Process();
... ...
的方式调用python脚本,执行到
python文件的:
import win32com
from win32com.client import Dispatch, constants
ppt = win32com.client.Dispatch('PowerPoint.Application')
try:
pptSel = ppt.Presentations.Open(file_name, ReadOnly=1, Untitled=0, WithWindow=1)
except Exception, e:
print e
print traceback.format_exc()
这里,python就会抛出错误:存储空间不足,无法完成此操作。
也想过使用.net环境下
using Microsoft.Office.Core;
using PPT = Microsoft.Office.Interop.PowerPoint;
... ...
persentation = application.Presentations.Open(sourcePath, MsoTriState.msoTrue, MsoTriState.msoFalse, MsoTriState.msoFalse);
这样的方式,可是在iis上执行到这里也会报错误“内存不足无法继续此操作”的错误。
各位大神谁来告诉我到底是什么原因啊,我也好找针对错误原因的解决办法。
1
down vote
In my situation (converting presentation to video, and I have very similar problem with open stuff) this helps:
Creating the following directories:
C:\Windows\SysWOW64\config\systemprofile\Desktop
C:\Windows\System32\config\systemprofile\Desktop (I don't have this)
My operating system Windows Server 2012 R2 Standard
[OutOfMemoryException: 没有足够的内存继续执行程序。]
Microsoft.Office.Interop.PowerPoint.Presentations.Open(String FileName, MsoTriState ReadOnly, MsoTriState Untitled, MsoTriState WithWindow) +0
AverageHandler.PPTConvertToIMG(String sourcePath, String targetPath) +126
AverageHandler.ProcessRequest(HttpContext context) +627
System.Web.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() +508
System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously) +92
[OutOfMemoryException: 没有足够的内存继续执行程序。]
Microsoft.Office.Interop.PowerPoint.Presentations.Open(String FileName, MsoTriState ReadOnly, MsoTriState Untitled, MsoTriState WithWindow) +0
AverageHandler.PPTConvertToIMG(String sourcePath, String targetPath) +126
AverageHandler.ProcessRequest(HttpContext context) +627
System.Web.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() +508
System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously) +92
哥们,你这问题最后怎么解决的