0

我有一个用于上传 PDF 的 C#/MVC 网站,当多个浏览器实例尝试同时上传时,使用Ghostscript.Net v 1.2.1,我收到以下错误:

Ghostscript.NET.GhostscriptAPICallException:调用“gsapi_new_instance”时发生错误:Ghostscript.NET.Interpreter.GhostscriptInterpreter.Initialize() 处的 Ghostscript.NET.Interpreter.GhostscriptInterpreter..ctor 的 -100(GhostscriptVersionInfo 版本,来自内存的布尔值)在 Ghostscript.NET.Viewer.GhostscriptViewer.Open(String path, GhostscriptVersionInfo versionInfo, Boolean dllFromMemory) 在 Ghostscript.NET.Viewer.GhostscriptViewer.Open(Stream stream, GhostscriptVersionInfo versionInfo, Boolean dllFromMemory) 在 Ghostscript.NET.Rasterizer.GhostscriptRasterizer.Open (Stream stream, GhostscriptVersionInfo versionInfo, Boolean dllFromMemory)`

它在这里中断:

private Ghostscript.NET.GhostscriptVersionInfo _version = Ghostscript.NET.GhostscriptVersionInfo.GetLastInstalledVersion(Ghostscript.NET.GhostscriptLicense.GPL | Ghostscript.NET.GhostscriptLicense.AFPL, Ghostscript.NET.GhostscriptLicense.GPL); 

using (var raster = new GhostscriptRasterizer())
{               
    raster.Open(fileStream, _version, false);
}

在公开赛上。此代码是从由 a 调用的函数中调用的async Task<ActionResult>。我想知道是否以async某种方式破坏了它。在该GhostScript站点上,我能找到的最接近的相关答案是确保我Close()/Dispose()之前的实例 - 但这不是我的问题,因为问题是不同浏览器会话中的伴随实例调用到同一个 .dll (它确实在IIS)。

没有引用任何静态变量,它发生在原始HttpPost.

4

1 回答 1

3

根据https://github.com/jhabjan/Ghostscript.NET/issues/10,您可能需要更改:

raster.Open(fileStream, _version, false);

至:

raster.Open(fileStream, _version, true);
于 2017-07-20T13:07:13.173 回答