Magick.NET-Q16-AnyCPU和iis服务器

Magick.NET-Q16-AnyCPU and iis server

我有这个问题:

1) 我已经在 VS2010 中通过 NUGET 下载了 Magick.NET-Q16-AnyCPU。 2) 我已经创建了这个函数来读取远程 svg 并将其转换为 itextSharp.text.Image 对象,如下所示:

iTextSharp.text.Image headeImage = null;

using (MagickImage image= new MagickImage(linksvgremote))
{ 
   Percentage percent = new Percentage(55);
   image.Resize(percent);
   headeImage = iTextSharp.text.Image.GetInstance(image.ToByteArray(MagickFormat.Png));

}

Javascript函数为:

 ApriDialogCaricamento();  
  var datiInput = {};

    datiInput.idTipo = idtipo;
    datiInput.clearEngine = clearengine;
    datiInput.nomeFileSvg = numfile;

    var jsonData = JSON.stringify(datiInput);

    var xhr = new XMLHttpRequest();
    xhr.onreadystatechange = function () {
        if (this.readyState == 4 && this.status == 200) {

            ChiudiDialogCaricamento();

            var url = window.URL || window.webkitURL;
            window.open(url.createObjectURL(this.response));
        }
    }

    xhr.open('POST', 'handlers/generaDatiTecniciPDF.ashx');
    xhr.responseType = 'blob';
    xhr.setRequestHeader('Content-Type', 'application/pdf');
    xhr.send(jsonData); 

它在本地工作正常,但是当我在 iis 服务器上上传时 javascript 函数 return 这个字符串:

无法加载资源,服务器响应状态为 500(内部服务器错误)

据说问题出在上面描述的函数中....我知道它是因为如果我评论它它可以工作但不会生成 svg-converted-image 。

如何在我的服务器上解决它?

谢谢

麦克

您很可能会遇到此异常,因为您没有对用于存储嵌入式 dll 的目录的写入权限。根据您 运行 Magick.NET 平台的不同,它会将 x86 或 x64 dll 写入临时目录。目录的位置是 MagickAnyCPU.CacheDirectory 将此 属性 设置为您的应用程序可以写入的文件夹可能会解决问题。