我正在使用asp.net mvc和rotativa将当前的html页面转换为pdf。 Rotativa使用wkhtmltopdf。
该网站将是Intranet应用程序。
我将网站发布到服务器上,当我使用内部IP地址和专用端口连接我的网站时,一切正常,
但是我的问题是,每当我使用外部IP和端口连接到网站时,当用户进行转换为pdf程序时都会遇到错误 错误如下:
我对此错误进行了一些研究,但是当我尝试这些解决方案时,没有一个对我有用。 我尝试过:
我的代码:
public ActionResult PrintAllReport()
{
var root = Server.MapPath("~/PDF/");
var pdfname = "asd"+".pdf";
var path = Path.Combine(root, pdfname);
path = Path.GetFullPath(path);
var report = new ActionAsPdf("Test", new { id = id });
report.PageSize = Rotativa.Options.Size.A4;
report.PageOrientation = Rotativa.Options.Orientation.Portrait;
var fileStream = new FileStream(path, FileMode.Create, FileAccess.Write);
fileStream.Write(binary, 0, binary.Length);
fileStream.Close();
return report;
}
希望你们能帮助我解决这个问题。 预先感谢。