【发布时间】:2016-05-09 09:48:48
【问题描述】:
我有这个问题:
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 函数返回此字符串:
加载资源失败,服务器响应状态为 500(服务器内部错误)
据说问题出在上面描述的函数中......我知道,因为如果我评论它,它可以工作但不会生成 svg-converted-image 。
如何在我的服务器上解决它?
谢谢
迈克
【问题讨论】:
-
您不能尝试先使用
WebClient下载图片并为MagickImage使用另一个构造函数吗?链接是什么?很难判断在该库中执行了什么请求以进行调试。 -
不是现在……我想解决问题……
-
请澄清:您说的是 javascript 函数,但不要将代码提供给我们。给定的 C# 代码中是否存在异常?我虽然当
linksvgremote类似于http://..../a.svg并且代码收到500试图下载由构造函数触发的链接时会发生错误。对吗? -
我认为这是正确的马克西米利安.....请......帮助我......
标签: c# magick.net