【发布时间】:2025-12-20 16:20:28
【问题描述】:
我编写了一个代码,将演示文稿中的所有幻灯片保存为 jpeg。它在我系统上本地的 Visual Studio 中运行良好,但是当我在 Azure 应用服务上部署它时,出现 500 内部服务器错误。
代码:
using pptd = NetOffice.PowerPointApi;
using NetOffice.PowerPointApi.Enums;
using NetOffice.OfficeApi.Enums;
public void genThumbnails(string originalfileName,string renamedFilename, string dirPath)
{
pptd.Application pptApplication = new pptd.Application();
pptd.Presentation pptPresentation = pptApplication.Presentations.Open(dirPath + renamedFilename, MsoTriState.msoFalse, MsoTriState.msoFalse, MsoTriState.msoFalse);
int i = 0;
foreach (pptd.Slide pptSlide in pptPresentation.Slides)
{
pptSlide.Export(dirPath + originalfileName + "_slide" + i + ".jpg", "jpg", 1280, 720);
i++;
}
pptPresentation.Close();
}
我做错了什么? NetOffice 软件包是否也需要像 Office.Interop 一样在服务器上安装 MS Office?
【问题讨论】:
标签: azure azure-web-app-service azure-app-service-envrmnt azure-appservice netoffice